1.2.1 • Published 5 years ago

node-svn-ultimate v1.2.1

Weekly downloads
1,154
License
-
Repository
github
Last release
5 years ago

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.checkout(url, dir, options, callback)

Checks out a repository to a working copy

Kind: static method of commands

ParamTypeDescription
urlstringRepository URL
dirstringWorking copy dir
optionsobjectOptions object
callbackfunctionComplete callback

commands.add(files, options, callback)

Adds a file / folder to a working copy

Kind: static method of commands

ParamTypeDescription
filesArray | stringAdd given files / folders
optionsobjectOptions object
callbackfunctionComplete 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

ParamTypeDescription
targetsArray | stringArray of URLs or working copy files to catalogue
optionsobjectOptions object
callbackfunctionComplete callback

commands.cleanup(wc, options, callback)

Performs an svn cleanup operation on the working copy

Kind: static method of commands

ParamTypeDescription
wcstringWorking copy directory to clean
optionsobjectOptions object
callbackfunctionComplete callback

commands.commit(files, options, callback)

Commits a working copy to a repository

Kind: static method of commands

ParamTypeDescription
filesArray | stringArray of files / folders to commit
optionsobjectOptions object
callbackfunctionComplete callback

commands.copy(srcs, dst, options, callback)

Copies a file / folder within either a working copy or a URL

Kind: static method of commands

ParamTypeDescription
srcsArray | stringURLs / files to copy
dststringdestination
optionsobjectOptions object
callbackfunctionComplete callback

commands.del(srcs, options, callback)

Deletes a file/folder from either a working copy or a URL

Kind: static method of commands

ParamTypeDescription
srcsArray | stringArray of URLs / files to delete
optionsobjectOptions object
callbackfunctionComplete callback

commands.export(src, dst, options, callback)

Exports a file from the repository to a local file

Kind: static method of commands

ParamTypeDescription
srcstringSource URL
dststringDestination file
optionsobjectOptions object
callbackfunctionComplete callback

commands.import(src, dst, options, callback)

Imports a file to the repository

Kind: static method of commands

ParamTypeDescription
srcstringSource file
dststringDestination URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.info(targets, options, callback)

Performs an svn info command on a given working copy file / URL

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs / files to info
optionsobjectOptions object
callbackfunctionComplete callback

commands.list(targets, options, callback)

Lists the files within a directory, either working copy or URL

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs / files to list
optionsobjectOptions object
callbackfunctionComplete callback

commands.lock(targets, options, callback)

Locks a file in a working copy / repository

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs / files to lock
optionsobjectOptions object
callbackfunctionComplete callback

commands.log(targets, options, callback)

Gets the SVN message log and returns as a JSON object

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs / files to get logs for
optionsobjectOptions object
callbackfunctionComplete callback

commands.merge(targets, options, callback)

Apply the differences between two sources to a working copy path

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs
optionsobjectOptions object
callbackfunctionComplete callback

commands.mergeinfo(source, target, options, callback)

Query information related to merges (or potential merges) between SOURCE and TARGET.

Kind: static method of commands

ParamTypeDescription
sourcestringSOURCE URL
targetstringTARGET URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.mkdir(targets, options, callback)

Creates a directory in the working copy or repository

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget URLs / folders to create
optionsobjectOptions object
callbackfunctionComplete callback

commands.move(srcs, dst, options, callback)

Moves a file / folder in a working copy or URL

Kind: static method of commands

ParamTypeDescription
srcsArray | stringTarget URLs / files to move
dststringDestination URL / file
optionsobjectOptions object
callbackfunctionComplete callback

commands.propdel(propName, target, options, callback)

Deletes an svn property from a working copy / repository

Kind: static method of commands

ParamTypeDescription
propNamestringProperty name
targetstringTarget file / folder or URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.propget(propName, targets, options, callback)

Gets an svn property from a working copy / repository

Kind: static method of commands

ParamTypeDescription
propNamestringProperty name
targetsArray | stringTarget file / folder or URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.proplist(targets, options, callback)

Lists svn properties from a working copy / repository

Kind: static method of commands

ParamTypeDescription
targetsArray | stringTarget file / folder or URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.propset(propName, propVal, wc, options, callback)

Sets an svn property from a working copy / repository

Kind: static method of commands

ParamTypeDescription
propNamestringProperty name
propValstringProperty value
wcstringTarget file / folder or URL
optionsobjectOptions object
callbackfunctionComplete callback

commands.relocate(url, wc, options, callback)

Relocates an svn working copy

Kind: static method of commands

ParamTypeDescription
urlstringRelocation URL
wcstringWorking copy to relocate
optionsobjectOptions object
callbackfunctionComplete callback

commands.revert(wc, options, callback)

Reverts files / folders in a working copy to their uncommited state

Kind: static method of commands

ParamTypeDescription
wcstringWorking copy target
optionsobjectOptions object
callbackfunctionComplete callback

commands.status(wc, options, callback)

Performs an svn status command on a working copy

Kind: static method of commands

ParamTypeDescription
wcstringWorking copy target
optionsobjectOptions object
callbackfunctionComplete callback

commands.switch(url, wc, options, callback)

Switches to a given branch / tag for a working copy

Kind: static method of commands

ParamTypeDescription
urlstringSwitch URL
wcstringWorking copy target
optionsobjectOptions object
callbackfunctionComplete callback

commands.unlock(targets, options, callback)

Unlocks a previously locked svn file from a working copy / repository

Kind: static method of commands

ParamTypeDescription
targetsArray | stringWorking copy / URL targets
optionsobjectOptions object
callbackfunctionComplete callback

commands.update(wcs, options, callback)

Updates an svn working copy

Kind: static method of commands

ParamTypeDescription
wcsArray | stringWorking copy targets
optionsobjectOptions object
callbackfunctionComplete callback

commands.upgrade(wcs, options, callback)

Upgrades a given svn working copy (requires v1.7 of svn client)

Kind: static method of commands

ParamTypeDescription
wcsArray | stringWorking copy targets
optionsobjectOptions object
callbackfunctionComplete 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

ParamTypeDescription
commandArrayArrayArray of command strings, see above link for options
commitMessagestringCommit message to use
optionsobjectOptions object
callbackfunctionComplete callback

util : object

Exposes some custom utility methods

Kind: global namespace

util.getRevision(target, options, callback)

Gets head revision of a given URL

Kind: static method of util

ParamTypeDescription
targetstringTarget URL
optionsobjectOptions object
callbackfunctionComplete callback

util.getWorkingCopyRevision(wcDir, options, callback)

Gets the revision of a working copy.

Kind: static method of util

ParamTypeDescription
wcDirstringWorking copy folder
optionsobjectOptions object
callbackfunctionComplete callback

util.parseUrl(url) ? object

Parse a url for an SVN project repository and breaks it apart

Kind: static method of util

ParamTypeDescription
urlstringURL to parse

util.getTags(url, options, callback)

Gets all available tags for the given svn URL

Kind: static method of util

ParamTypeDescription
urlstringProject URL to get tags for
optionsobjectOptions object
callbackfunctionComplete callback

util.getLatestTag(url, options, callback)

Uses node's semver package to work out the latest tag value

Kind: static method of util

ParamTypeDescription
urlstringProject URL to get latest tag for
optionsobjectOptions object
callbackfunctionComplete callback

util.getBranches(url, options, callback)

Gets all available branches for the given svn URL

Kind: static method of util

ParamTypeDescription
urlstringProject URL to get branches for
optionsobjectOptions object
callbackfunctionComplete callback