GithubHelp home page GithubHelp logo

luyongfugx / node-svn-spawn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ddliu/node-svn-spawn

0.0 2.0 0.0 181 KB

Easy way to access svn repository with node.js.

License: MIT License

JavaScript 96.94% Shell 3.06%

node-svn-spawn's Introduction

svn-spawn

Build Status

Easy way to access svn repository with node.js.

Features

  • Easy to use
  • Fast way to add local changes
  • Query svn infomation as array or object
  • Common svn commands are all supported

Usage

Create a svn client instance

var Client = require('svn-spawn');
var client = new Client({
    cwd: '/path to your svn working directory',
    username: 'username', // optional if authentication not required or is already saved
    password: 'password', // optional if authentication not required or is already saved
});

svn update

client.update(function(err, data) {
    console.log('updated');
});

svn info

client.getInfo(function(err, data) {
    console.log('Repository url is %s', data.url);
});

Make some changes and commit all

client.addLocal(function(err, data) {
    console.log('all local changes has been added for commit');

    client.commit('commit message here', function(err, data) {
        console.log('local changes has been committed!');
    });
});

Single file

client.add('relative/path/to/file', function(err, data) {
    client.commit(['commit message here', 'relative/path/to/file'], function(err, data) {
        console.log('committed one file!');
    });
});

Run any svn command

client.cmd(['subcommand', '--option1=xx', '--option2=xx', 'arg1', 'arg2'], function(err, data) {
    console.log('subcommand done');
});

Result Object

getXXX methods will return parsed data as object.

getInfo result example:

{
  "$": {
    "path": ".",
    "revision": "1",
    "kind": "dir"
  },
  "url": "file:///home/dong/projects/node-packages/node-svn-spawn/test/tmp/repo",
  "repository": {
    "root": "file:///home/dong/projects/node-packages/node-svn-spawn/test/tmp/repo",
    "uuid": "302eb8ee-a81a-4432-8477-1ad8fe3a9a1e"
  },
  "wc-info": {
    "wcroot-abspath": "/home/dong/projects/node-packages/node-svn-spawn/test/tmp/copy",
    "schedule": "normal",
    "depth": "infinity"
  },
  "commit": {
    "$": {
      "revision": "1"
    },
    "author": "dong",
    "date": "2013-11-08T02:07:25.884985Z"
  }
}

getLog result example:

[
    {
      "$": {
        "revision": "1"
      },
      "author": "dong",
      "date": "2013-11-08T02:10:37.656902Z",
      "msg": "init repo"
    },
    ...
]

getStatus result example:

[
  {
    "$": {
      "path": "a.txt"
    },
    "wc-status": {
      "$": {
        "props": "none",
        "item": "modified",
        "revision": "1"
      },
      "commit": {
        "$": {
          "revision": "1"
        },
        "author": "dong",
        "date": "2013-11-08T02:17:20.390152Z"
      }
    }
  }
]

Requirements

You need to have the svn command installed.

Installation

npm install svn-spawn

Changelog

v0.1.0 (2013-05-23)

Inital version

v0.1.1 (2013-06-07)

Fix addLocal bug; add some tests

v0.1.2 (2013-10-08)

Fix checkout bug(if target folder does not exist); fix getLog bug;travis-ci

v0.1.3 (2013-11-08)

Detailed document for query result such as svn info, svn log, svn status etc.

v0.1.4 (2013-12-12)

Add authontication support

node-svn-spawn's People

Contributors

ddliu avatar luyongfugx avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.