Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added svn add functionality #4

Open
wants to merge 3 commits into
base: node10
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"sources": [
"src/svn.cc",
"src/svn_cat.cc",
"src/svn_add.cc",
"src/svn_auth.cc",
"src/svn_checkout.cc",
"src/svn_commit.cc",
Expand Down Expand Up @@ -44,7 +45,8 @@
"-lexpat",
"<(neon_lib)/libneon.a",
"-luuid",
"-lz"
"-lz",
"-lmagic"
]
},
{
Expand Down
10 changes: 10 additions & 0 deletions build_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x

BUILDDIR=$(dirname $0)
BUILDDIR="$(readlink -f $BUILDDIR)/build"
FILEDIR="$BUILDDIR/file"

if [ -n "$FILEDIR/lib/libfile.a" ]; then
mkdir -p $FILEDIR && cd deps/file-5.14 && ./configure --prefix=$FILEDIR && make clean install
fi

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"version": "0.3.0",
"version": "0.3.1",
"name": "kubek-nodesvn",
"main": "bin/nodesvn.js",
"author": {
"name": "Daniel Enman",
"email": "[email protected]"
},
"contributors": [
"Jakub Lekstan <[email protected]>"
"Jakub Lekstan <[email protected]>",
"Albert Łącki <[email protected]>"
],
"engines": {
"node": ">= 0.10.0"
"node": ">= 0.8.0"
}
}
1 change: 1 addition & 0 deletions src/svn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void SVN::InitModule(Handle<Object> target)
ct->InstanceTemplate()->SetInternalFieldCount(1);
ct->SetClassName(String::NewSymbol("client"));

NODE_SET_PROTOTYPE_METHOD(ct, "add", __add);
NODE_SET_PROTOTYPE_METHOD(ct, "authenticate", __authenticate);
NODE_SET_PROTOTYPE_METHOD(ct, "cat", __cat);
NODE_SET_PROTOTYPE_METHOD(ct, "checkout", __checkout);
Expand Down
30 changes: 30 additions & 0 deletions src/svn_add.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "svn.h"

Handle<Value> SVN::__add (const Arguments &args) {
HandleScope scope;

//system
SVN *svn = ObjectWrap::Unwrap<SVN>(args.This());
apr_pool_t *subpool = svn_pool_create(svn->pool);
svn_error_t *err;

//svn
const char *path;

//additional
Local<Object> result;

String::Utf8Value jsPath (args[0]->ToString());
path = apr_pstrdup(subpool, *jsPath);

if ( (err = svn_client_add4(path, svn_depth_infinity, 0, 0, 0, svn->ctx, subpool)) ) {
result = Local<Object>::New(svn->error(err));
} else {
result = Object::New();
result->Set(status_symbol, Integer::New(0));
}

POOL_DESTROY

return scope.Close(result);
}