node-svn-ultimate v1.2.1
node-svn-ultimate
This project is no longer maintained
The ultimate SVN wrapper for node. Contains all the methods exposed by the command line svn tool, including checkout, update, info, etc, and includes svnmucc support.
Has methods for manipulating both working copies and the repo directly.
All direct svn command line functions are exposed through the commands object, and accept the same parameters as the command line tool.
Utility methods are provided through a util object.
npm install node-svn-ultimate --save
Example usage
var svnUltimate = require('node-svn-ultimate');
svnUltimate.commands.checkout( 'https://my.url/svn/repo', '/home/user/checkout', function( err ) {
console.log( "Checkout complete" );
} );
svnUltimate.commands.update( '/home/user/checkout',
{ // optional options object - can be passed to any command not just update
trustServerCert: true, // same as --trust-server-cert
username: "username", // same as --username
password: "password", // same as --password
shell: "sh", // override shell used to execute command
cwd: process.cwd(), // override working directory command is executed
quiet: true, // provide --quiet to commands that accept it
force: true, // provide --force to commands that accept it
revision: 33050, // provide --revision to commands that accept it
depth: "empty", // provide --depth to commands that accept it
ignoreExternals: true, // provide --ignore-externals to commands that accept it
params: [ '-m "Commit comment"' ], // extra parameters to pass
'config-option': [
'servers:global:http-proxy-host=proxy.someProxy.com',
'servers:global:http-proxy-port=8080',
] // provide --config-option to commands that accept it. Use an array for multiple config options
},
function( err ) {
console.log( "Update complete" );
} );
Utility methods
// Gets the working copy revision or the HEAD revision if the target is a URL
svnUltimate.util.getRevision( 'https://my.url/svn/repo', function( err, revision ) {
console.log( "Head revision=" + revision );
} );
var obj = svnUltimate.util.parseUrl( 'https://my.url/svn/repo/trunk' );
// this call will return an object comprising of
obj = {
rootUrl: 'https://my.url/svn/repo',
type: 'trunk', // either trunk, tags, or branches
typeName: '1.3.5' // only populated if a tag or a branch, name of the tag or branch
trunkUrl: 'https://my.url/svn/repo/trunk',
tagsUrl: 'https://my.url/svn/repo/tags',
branchesUrl: 'https://my.url/svn/repo/branches'
};
svnUltimate.util.getTags( 'https://my.url/svn/repo/trunk', function( err, tagsArray ) {
// tagsArray will be an array of strings containing all tag names
} );
svnUltimate.util.getLatestTag( 'https://my.url/svn/repo/trunk', function( err, latestTag ) {
// latestTag will be the most recent tag, worked out by semver comparison (not the date it was created)
} );
Methods
commands : object
Exposes the commands for the command line svn tool.
Kind: global namespace
- commands : object
- .checkout(url, dir, [options], [callback])
- .add(files, [options], [callback])
- .cat(targets, [options], [callback])
- .cleanup(wc, [options], [callback])
- .commit(files, [options], [callback])
- .copy(srcs, dst, [options], [callback])
- .del(srcs, [options], [callback])
- .export(src, dst, [options], [callback])
- .import(src, dst, [options], [callback])
- .info(targets, [options], [callback])
- .list(targets, [options], [callback])
- .lock(targets, [options], [callback])
- .log(targets, [options], [callback])
- .merge(targets, [options], [callback])
- .mergeinfo(source, target, [options], [callback])
- .mkdir(targets, [options], [callback])
- .move(srcs, dst, [options], [callback])
- .propdel(propName, target, [options], [callback])
- .propget(propName, targets, [options], [callback])
- .proplist(targets, [options], [callback])
- .propset(propName, propVal, wc, [options], [callback])
- .relocate(url, wc, [options], [callback])
- .revert(wc, [options], [callback])
- .status(wc, [options], [callback])
- .switch(url, wc, [options], [callback])
- .unlock(targets, [options], [callback])
- .update(wcs, [options], [callback])
- .upgrade(wcs, [options], [callback])
- .mucc(commandArray, commitMessage, [options], [callback])
commands.checkout(url, dir, options, callback)
Checks out a repository to a working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
url | string | Repository URL |
dir | string | Working copy dir |
options | object | Options object |
callback | function | Complete callback |
commands.add(files, options, callback)
Adds a file / folder to a working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
files | Array | string | Add given files / folders |
options | object | Options object |
callback | function | Complete callback |
commands.cat(targets, options, callback)
Gets the content of a file from either a working copy or a URL.
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Array of URLs or working copy files to catalogue |
options | object | Options object |
callback | function | Complete callback |
commands.cleanup(wc, options, callback)
Performs an svn cleanup operation on the working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
wc | string | Working copy directory to clean |
options | object | Options object |
callback | function | Complete callback |
commands.commit(files, options, callback)
Commits a working copy to a repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
files | Array | string | Array of files / folders to commit |
options | object | Options object |
callback | function | Complete callback |
commands.copy(srcs, dst, options, callback)
Copies a file / folder within either a working copy or a URL
Kind: static method of commands
Param | Type | Description |
---|---|---|
srcs | Array | string | URLs / files to copy |
dst | string | destination |
options | object | Options object |
callback | function | Complete callback |
commands.del(srcs, options, callback)
Deletes a file/folder from either a working copy or a URL
Kind: static method of commands
Param | Type | Description |
---|---|---|
srcs | Array | string | Array of URLs / files to delete |
options | object | Options object |
callback | function | Complete callback |
commands.export(src, dst, options, callback)
Exports a file from the repository to a local file
Kind: static method of commands
Param | Type | Description |
---|---|---|
src | string | Source URL |
dst | string | Destination file |
options | object | Options object |
callback | function | Complete callback |
commands.import(src, dst, options, callback)
Imports a file to the repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
src | string | Source file |
dst | string | Destination URL |
options | object | Options object |
callback | function | Complete callback |
commands.info(targets, options, callback)
Performs an svn info command on a given working copy file / URL
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs / files to info |
options | object | Options object |
callback | function | Complete callback |
commands.list(targets, options, callback)
Lists the files within a directory, either working copy or URL
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs / files to list |
options | object | Options object |
callback | function | Complete callback |
commands.lock(targets, options, callback)
Locks a file in a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs / files to lock |
options | object | Options object |
callback | function | Complete callback |
commands.log(targets, options, callback)
Gets the SVN message log and returns as a JSON object
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs / files to get logs for |
options | object | Options object |
callback | function | Complete callback |
commands.merge(targets, options, callback)
Apply the differences between two sources to a working copy path
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs |
options | object | Options object |
callback | function | Complete callback |
commands.mergeinfo(source, target, options, callback)
Query information related to merges (or potential merges) between SOURCE and TARGET.
Kind: static method of commands
Param | Type | Description |
---|---|---|
source | string | SOURCE URL |
target | string | TARGET URL |
options | object | Options object |
callback | function | Complete callback |
commands.mkdir(targets, options, callback)
Creates a directory in the working copy or repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target URLs / folders to create |
options | object | Options object |
callback | function | Complete callback |
commands.move(srcs, dst, options, callback)
Moves a file / folder in a working copy or URL
Kind: static method of commands
Param | Type | Description |
---|---|---|
srcs | Array | string | Target URLs / files to move |
dst | string | Destination URL / file |
options | object | Options object |
callback | function | Complete callback |
commands.propdel(propName, target, options, callback)
Deletes an svn property from a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
propName | string | Property name |
target | string | Target file / folder or URL |
options | object | Options object |
callback | function | Complete callback |
commands.propget(propName, targets, options, callback)
Gets an svn property from a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
propName | string | Property name |
targets | Array | string | Target file / folder or URL |
options | object | Options object |
callback | function | Complete callback |
commands.proplist(targets, options, callback)
Lists svn properties from a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Target file / folder or URL |
options | object | Options object |
callback | function | Complete callback |
commands.propset(propName, propVal, wc, options, callback)
Sets an svn property from a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
propName | string | Property name |
propVal | string | Property value |
wc | string | Target file / folder or URL |
options | object | Options object |
callback | function | Complete callback |
commands.relocate(url, wc, options, callback)
Relocates an svn working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
url | string | Relocation URL |
wc | string | Working copy to relocate |
options | object | Options object |
callback | function | Complete callback |
commands.revert(wc, options, callback)
Reverts files / folders in a working copy to their uncommited state
Kind: static method of commands
Param | Type | Description |
---|---|---|
wc | string | Working copy target |
options | object | Options object |
callback | function | Complete callback |
commands.status(wc, options, callback)
Performs an svn status command on a working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
wc | string | Working copy target |
options | object | Options object |
callback | function | Complete callback |
commands.switch(url, wc, options, callback)
Switches to a given branch / tag for a working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
url | string | Switch URL |
wc | string | Working copy target |
options | object | Options object |
callback | function | Complete callback |
commands.unlock(targets, options, callback)
Unlocks a previously locked svn file from a working copy / repository
Kind: static method of commands
Param | Type | Description |
---|---|---|
targets | Array | string | Working copy / URL targets |
options | object | Options object |
callback | function | Complete callback |
commands.update(wcs, options, callback)
Updates an svn working copy
Kind: static method of commands
Param | Type | Description |
---|---|---|
wcs | Array | string | Working copy targets |
options | object | Options object |
callback | function | Complete callback |
commands.upgrade(wcs, options, callback)
Upgrades a given svn working copy (requires v1.7 of svn client)
Kind: static method of commands
Param | Type | Description |
---|---|---|
wcs | Array | string | Working copy targets |
options | object | Options object |
callback | function | Complete callback |
commands.mucc(commandArray, commitMessage, options, callback)
Executes svnmucc command, for multiple commands
Kind: static method of commands
See: http://svnbook.red-bean.com/en/1.8/svn.ref.svnmucc.re.html
Param | Type | Description |
---|---|---|
commandArray | Array | Array of command strings, see above link for options |
commitMessage | string | Commit message to use |
options | object | Options object |
callback | function | Complete callback |
util : object
Exposes some custom utility methods
Kind: global namespace
- util : object
util.getRevision(target, options, callback)
Gets head revision of a given URL
Kind: static method of util
Param | Type | Description |
---|---|---|
target | string | Target URL |
options | object | Options object |
callback | function | Complete callback |
util.getWorkingCopyRevision(wcDir, options, callback)
Gets the revision of a working copy.
Kind: static method of util
Param | Type | Description |
---|---|---|
wcDir | string | Working copy folder |
options | object | Options object |
callback | function | Complete callback |
util.parseUrl(url) ? object
Parse a url for an SVN project repository and breaks it apart
Kind: static method of util
Param | Type | Description |
---|---|---|
url | string | URL to parse |
util.getTags(url, options, callback)
Gets all available tags for the given svn URL
Kind: static method of util
Param | Type | Description |
---|---|---|
url | string | Project URL to get tags for |
options | object | Options object |
callback | function | Complete callback |
util.getLatestTag(url, options, callback)
Uses node's semver package to work out the latest tag value
Kind: static method of util
Param | Type | Description |
---|---|---|
url | string | Project URL to get latest tag for |
options | object | Options object |
callback | function | Complete callback |
util.getBranches(url, options, callback)
Gets all available branches for the given svn URL
Kind: static method of util
Param | Type | Description |
---|---|---|
url | string | Project URL to get branches for |
options | object | Options object |
callback | function | Complete callback |
5 years ago
6 years ago
7 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago