org.tmatesoft.svn.core.wc

Class SVNWCClient

public class SVNWCClient extends SVNBasicClient

The SVNWCClient class combines a number of version control operations mainly intended for local work with Working Copy items. This class includes those operations that are destined only for local work on a Working Copy as well as those that are moreover able to access a repository.

Here's a list of the SVNWCClient's methods matched against corresponing commands of the SVN command line client:

SVNKit Subversion
doAdd()'svn add'
doDelete()'svn delete'
doCleanup()'svn cleanup'
doInfo()'svn info'
doLock()'svn lock'
doUnlock()'svn unlock'
doSetProperty() 'svn propset PROPNAME PROPVAL PATH'
'svn propdel PROPNAME PATH'
'svn propedit PROPNAME PATH'
doSetRevisionProperty() 'svn propset PROPNAME --revprop -r REV PROPVAL [URL]'
'svn propdel PROPNAME --revprop -r REV [URL]'
'svn propedit PROPNAME --revprop -r REV [URL]'
doGetProperty() 'svn propget PROPNAME PATH'
'svn proplist PATH'
doGetRevisionProperty() 'svn propget PROPNAME --revprop -r REV [URL]'
'svn proplist --revprop -r REV [URL]'
doResolve()'svn resolved'
doRevert()'svn revert'

Version: 1.1.1

Author: TMate Software Ltd.

See Also: Examples

Field Summary
static ISVNAddParametersDEFAULT_ADD_PARAMETERS
Constructor Summary
SVNWCClient(ISVNAuthenticationManager authManager, ISVNOptions options)
Constructs and initializes an SVNWCClient object with the specified run-time configuration and authentication drivers.
SVNWCClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
Method Summary
voiddoAdd(File path, boolean force, boolean mkdir, boolean climbUnversionedParents, boolean recursive)
Schedules an unversioned item for addition to a repository thus putting it under version control.
voiddoAdd(File path, boolean force, boolean mkdir, boolean climbUnversionedParents, boolean recursive, boolean includeIgnored)
Schedules an unversioned item for addition to a repository thus putting it under version control.
voiddoCleanup(File path)
Recursively cleans up the working copy, removing locks and resuming unfinished operations.
voiddoDelete(File path, boolean force, boolean dryRun)
Schedules a Working Copy item for deletion.
voiddoDelete(File path, boolean force, boolean deleteFiles, boolean dryRun)
Schedules a Working Copy item for deletion.
voiddoGetFileContents(File path, SVNRevision pegRevision, SVNRevision revision, boolean expandKeywords, OutputStream dst)
Gets contents of a file.
voiddoGetFileContents(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean expandKeywords, OutputStream dst)
Gets contents of a file of a particular revision from a repository.
SVNPropertyDatadoGetProperty(File path, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive)
Gets an item's versioned property.
SVNPropertyDatadoGetProperty(SVNURL url, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive)
Gets an item's versioned property from a repository.
voiddoGetProperty(File path, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNPropertyHandler handler)
Gets an item's versioned property and passes it to a provided property handler.
voiddoGetProperty(SVNURL url, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNPropertyHandler handler)
Gets an item's versioned property from a repository and passes it to a provided property handler.
voiddoGetRevisionProperty(File path, String propName, SVNRevision revision, ISVNPropertyHandler handler)
Gets an unversioned revision property from a repository (getting a repository URL from a Working Copy) and passes it to a provided property handler.
voiddoGetRevisionProperty(SVNURL url, String propName, SVNRevision revision, ISVNPropertyHandler handler)
Gets an unversioned revision property from a repository and passes it to a provided property handler.
StringdoGetWorkingCopyID(File path, String trailURL)
Returns the current Working Copy min- and max- revisions as well as changes and switch status within a single string.
StringdoGetWorkingCopyID(File path, String trailURL, boolean committed)
voiddoInfo(File path, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about Working Copy item(s) and passes it to an info handler.
voiddoInfo(File path, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about Working Copy item(s) and passes it to an info handler.
voiddoInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about item(s) in a repository and passes it to an info handler.
SVNInfodoInfo(File path, SVNRevision revision)
Collects and returns information on a single Working Copy item.
SVNInfodoInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision)
Collects and returns information on a single item in a repository.
voiddoLock(File[] paths, boolean stealLock, String lockMessage)
Locks file items in a Working Copy as well as in a repository so that no other user can commit changes to them.
voiddoLock(SVNURL[] urls, boolean stealLock, String lockMessage)
Locks file items in a repository so that no other user can commit changes to them.
voiddoResolve(File path, boolean recursive)
Resolves a 'conflicted' state on a Working Copy item.
voiddoRevert(File path, boolean recursive)
Reverts all local changes made to a Working Copy item(s) thus bringing it to a 'pristine' state.
voiddoRevert(File[] paths, boolean recursive)
Reverts all local changes made to a Working Copy item(s) thus bringing it to a 'pristine' state.
voiddoSetProperty(File path, String propName, String propValue, boolean force, boolean recursive, ISVNPropertyHandler handler)
Sets, edits or deletes a property on a file or directory item(s).
voiddoSetRevisionProperty(File path, SVNRevision revision, String propName, String propValue, boolean force, ISVNPropertyHandler handler)
Sets, edits or deletes an unversioned revision property.
voiddoSetRevisionProperty(SVNURL url, SVNRevision revision, String propName, String propValue, boolean force, ISVNPropertyHandler handler)
Sets, edits or deletes an unversioned revision property.
voiddoUnlock(File[] paths, boolean breakLock)
Unlocks file items in a Working Copy as well as in a repository.
voiddoUnlock(SVNURL[] urls, boolean breakLock)
Unlocks file items in a repository.
protected ISVNAddParametersgetAddParameters()
voidsetAddParameters(ISVNAddParameters addParameters)

Field Detail

DEFAULT_ADD_PARAMETERS

public static ISVNAddParameters DEFAULT_ADD_PARAMETERS

Constructor Detail

SVNWCClient

public SVNWCClient(ISVNAuthenticationManager authManager, ISVNOptions options)
Constructs and initializes an SVNWCClient object with the specified run-time configuration and authentication drivers.

If options is null, then this SVNWCClient will be using a default run-time configuration driver which takes client-side settings from the default SVN's run-time configuration area but is not able to change those settings (read more on ISVNOptions and SVNWCUtil).

If authManager is null, then this SVNWCClient will be using a default authentication and network layers driver (see createDefaultAuthenticationManager) which uses server-side settings and auth storage from the default SVN's run-time configuration area (or system properties if that area is not found).

Parameters: authManager an authentication and network layers driver options a run-time configuration options driver

SVNWCClient

public SVNWCClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)

Method Detail

doAdd

public void doAdd(File path, boolean force, boolean mkdir, boolean climbUnversionedParents, boolean recursive)
Schedules an unversioned item for addition to a repository thus putting it under version control.

To create and add to version control a new directory, set mkdir to true.

Calling this method is equivalent to doAdd(path, force, mkdir, climbUnversionedParents, recursive, false).

Parameters: path a path to be put under version control (will be added to a repository in next commit) force true to force the operation to run mkdir if true - creates a new directory and schedules it for addition climbUnversionedParents if true and path is located in an unversioned parent directory then the parent will be automatically scheduled for addition, too recursive true to descend recursively (relevant for directories)

Throws: SVNException if one of the following is true:

doAdd

public void doAdd(File path, boolean force, boolean mkdir, boolean climbUnversionedParents, boolean recursive, boolean includeIgnored)
Schedules an unversioned item for addition to a repository thus putting it under version control.

To create and add to version control a new directory, set mkdir to true.

Parameters: path a path to be put under version control (will be added to a repository in next commit) force true to force the operation to run mkdir if true - creates a new directory and schedules it for addition climbUnversionedParents if true and path is located in an unversioned parent directory then the parent will be automatically scheduled for addition, too recursive true to descend recursively (relevant for directories) includeIgnored controls whether ignored items must be also added

Throws: SVNException if one of the following is true:

Since: 1.1

doCleanup

public void doCleanup(File path)
Recursively cleans up the working copy, removing locks and resuming unfinished operations.

If you ever get a "working copy locked" error, use this method to remove stale locks and get your working copy into a usable state again.

Parameters: path a WC path to start a cleanup from

Throws: SVNException if one of the following is true:

doDelete

public void doDelete(File path, boolean force, boolean dryRun)
Schedules a Working Copy item for deletion.

Parameters: path a WC item to be deleted force true to force the operation to run dryRun true only to try the delete operation without actual deleting

Throws: SVNException if one of the following is true:

See Also: SVNWCClient

doDelete

public void doDelete(File path, boolean force, boolean deleteFiles, boolean dryRun)
Schedules a Working Copy item for deletion. This method allows to choose - whether file item(s) are to be deleted from the filesystem or not. Another version of the doDelete() method is similar to the corresponding SVN client's command - 'svn delete' as it always deletes files from the filesystem.

Parameters: path a WC item to be deleted force true to force the operation to run deleteFiles if true then files will be scheduled for deletion as well as deleted from the filesystem, otherwise files will be only scheduled for addition and still be present in the filesystem dryRun true only to try the delete operation without actual deleting

Throws: SVNException if one of the following is true:

doGetFileContents

public void doGetFileContents(File path, SVNRevision pegRevision, SVNRevision revision, boolean expandKeywords, OutputStream dst)
Gets contents of a file. If revision is one of: then the file contents are taken from the Working Copy file item. Otherwise the file item's contents are taken from the repository at a particular revision.

Parameters: path a Working Copy file item pegRevision a revision in which the file item is first looked up revision a target revision expandKeywords if true then all keywords presenting in the file and listed in the file's svn:keywords property (if set) will be substituted, otherwise not dst the destination where the file contents will be written to

Throws: SVNException if one of the following is true:

See Also: SVNWCClient

doGetFileContents

public void doGetFileContents(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean expandKeywords, OutputStream dst)
Gets contents of a file of a particular revision from a repository.

Parameters: url a file item's repository location pegRevision a revision in which the file item is first looked up revision a target revision expandKeywords if true then all keywords presenting in the file and listed in the file's svn:keywords property (if set) will be substituted, otherwise not dst the destination where the file contents will be written to

Throws: SVNException if one of the following is true:

See Also: SVNWCClient

doGetProperty

public SVNPropertyData doGetProperty(File path, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive)
Gets an item's versioned property. It's possible to get either a local property (from a Working Copy) or a remote one (located in a repository). If revision is one of: then the result is a WC item's property. Otherwise the property is taken from a repository (using the item's URL).

Parameters: path a WC item's path propName an item's property name; if it's null then all the item's properties will be retrieved but only the first of them returned pegRevision a revision in which the item is first looked up revision a target revision; recursive true to descend recursively

Returns: the item's property

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doGetProperty

public SVNPropertyData doGetProperty(SVNURL url, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive)
Gets an item's versioned property from a repository. This method is useful when having no Working Copy at all.

Parameters: url an item's repository location propName an item's property name; if it's null then all the item's properties will be retrieved but only the first of them returned pegRevision a revision in which the item is first looked up revision a target revision recursive true to descend recursively

Returns: the item's property

Throws: SVNException if propName starts with the svn:wc: prefix

See Also: SVNWCClient SVNWCClient

doGetProperty

public void doGetProperty(File path, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNPropertyHandler handler)
Gets an item's versioned property and passes it to a provided property handler. It's possible to get either a local property (from a Working Copy) or a remote one (located in a repository). If revision is one of: then the result is a WC item's property. Otherwise the property is taken from a repository (using the item's URL).

Parameters: path a WC item's path propName an item's property name; if it's null then all the item's properties will be retrieved and passed to handler for processing pegRevision a revision in which the item is first looked up revision a target revision; recursive true to descend recursively handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doGetProperty

public void doGetProperty(SVNURL url, String propName, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNPropertyHandler handler)
Gets an item's versioned property from a repository and passes it to a provided property handler. This method is useful when having no Working Copy at all.

Parameters: url an item's repository location propName an item's property name; if it's null then all the item's properties will be retrieved and passed to handler for processing pegRevision a revision in which the item is first looked up revision a target revision recursive true to descend recursively handler a caller's property handler

Throws: SVNException if propName starts with the svn:wc: prefix

See Also: SVNWCClient SVNWCClient

doGetRevisionProperty

public void doGetRevisionProperty(File path, String propName, SVNRevision revision, ISVNPropertyHandler handler)
Gets an unversioned revision property from a repository (getting a repository URL from a Working Copy) and passes it to a provided property handler.

Parameters: path a local Working Copy item which repository location is used to connect to a repository propName a revision property name; if this parameter is null then all the revision properties will be retrieved and passed to handler for processing revision a revision which property is to be retrieved handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doGetRevisionProperty

public void doGetRevisionProperty(SVNURL url, String propName, SVNRevision revision, ISVNPropertyHandler handler)
Gets an unversioned revision property from a repository and passes it to a provided property handler.

Parameters: url a URL pointing to a repository location which revision property is to be got propName a revision property name; if this parameter is null then all the revision properties will be retrieved and passed to handler for processing revision a revision which property is to be retrieved handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doGetWorkingCopyID

public String doGetWorkingCopyID(File path, String trailURL)
Returns the current Working Copy min- and max- revisions as well as changes and switch status within a single string.

A return string has a form of "minR[:maxR][M][S]" where:

If path is a directory - this method recursively descends into the Working Copy, collects and processes local information.

Parameters: path a local path trailURL optional: if not null specifies the name of the item that should be met in the URL corresponding to the repository location of the path; if that URL ends with something different than this optional parameter - the Working Copy will be considered "switched"

Returns: brief info on the Working Copy or the string "exported" if path is a clean directory

Throws: SVNException if path is neither versioned nor even exported

doGetWorkingCopyID

public String doGetWorkingCopyID(File path, String trailURL, boolean committed)

doInfo

public void doInfo(File path, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about Working Copy item(s) and passes it to an info handler.

If revision is valid and not local, then information will be collected on remote items (that is taken from a repository). Otherwise information is gathered on local items not accessing a repository.

Parameters: path a WC item on which info should be obtained revision a target revision recursive true to descend recursively (relevant for directories) handler a caller's info handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doInfo

public void doInfo(File path, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about Working Copy item(s) and passes it to an info handler.

If revision & pegRevision are valid and not local, then information will be collected on remote items (that is taken from a repository). Otherwise information is gathered on local items not accessing a repository.

Parameters: path a WC item on which info should be obtained pegRevision a revision in which path is first looked up revision a target revision recursive true to descend recursively (relevant for directories) handler a caller's info handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doInfo

public void doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision, boolean recursive, ISVNInfoHandler handler)
Collects information about item(s) in a repository and passes it to an info handler.

Parameters: url a URL of an item which information is to be obtained and processed pegRevision a revision in which the item is first looked up revision a target revision recursive true to descend recursively (relevant for directories) handler a caller's info handler

Throws: SVNException if url is an item that does not exist in the specified revision

See Also: SVNWCClient SVNWCClient

doInfo

public SVNInfo doInfo(File path, SVNRevision revision)
Collects and returns information on a single Working Copy item.

If revision is valid and not WORKING then information will be collected on remote items (that is taken from a repository). Otherwise information is gathered on local items not accessing a repository.

Parameters: path a WC item on which info should be obtained revision a target revision

Returns: collected info

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient

doInfo

public SVNInfo doInfo(SVNURL url, SVNRevision pegRevision, SVNRevision revision)
Collects and returns information on a single item in a repository.

Parameters: url a URL of an item which information is to be obtained pegRevision a revision in which the item is first looked up revision a target revision

Returns: collected info

Throws: SVNException if url is an item that does not exist in the specified revision

See Also: SVNWCClient SVNWCClient

doLock

public void doLock(File[] paths, boolean stealLock, String lockMessage)
Locks file items in a Working Copy as well as in a repository so that no other user can commit changes to them.

Parameters: paths an array of local WC file paths that should be locked stealLock if true then all existing locks on the specified paths will be "stolen" lockMessage an optional lock comment

Throws: SVNException if one of the following is true:

See Also: (SVNURL[], boolean, String)

doLock

public void doLock(SVNURL[] urls, boolean stealLock, String lockMessage)
Locks file items in a repository so that no other user can commit changes to them.

Parameters: urls an array of URLs to be locked stealLock if true then all existing locks on the specified urls will be "stolen" lockMessage an optional lock comment

Throws: SVNException

See Also: (File[], boolean, String)

doResolve

public void doResolve(File path, boolean recursive)
Resolves a 'conflicted' state on a Working Copy item.

Parameters: path a WC item to be resolved recursive true to descend recursively (relevant for directories) - this will resolve the entire tree

Throws: SVNException if path is not under version control

doRevert

public void doRevert(File path, boolean recursive)
Reverts all local changes made to a Working Copy item(s) thus bringing it to a 'pristine' state.

Parameters: paths a WC paths to perform a revert on recursive true to descend recursively (relevant for directories)

Throws: SVNException if one of the following is true:

See Also: (File[], boolean)

doRevert

public void doRevert(File[] paths, boolean recursive)
Reverts all local changes made to a Working Copy item(s) thus bringing it to a 'pristine' state.

Parameters: paths a WC paths to perform a revert on recursive true to descend recursively (relevant for directories)

Throws: SVNException if one of the following is true:

Exception will not be thrown if there are multiple paths passed. Instead caller should process events received by ISVNEventHandler instance to get information on whether certain path was reverted or not.

doSetProperty

public void doSetProperty(File path, String propName, String propValue, boolean force, boolean recursive, ISVNPropertyHandler handler)
Sets, edits or deletes a property on a file or directory item(s).

To set or edit a property simply provide a propName and a propValue. To delete a property set propValue to null and the property propName will be deleted.

Parameters: path a WC item which properties are to be modified propName a property name propValue a property value force true to force the operation to run recursive true to descend recursively handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient SVNWCClient

doSetRevisionProperty

public void doSetRevisionProperty(File path, SVNRevision revision, String propName, String propValue, boolean force, ISVNPropertyHandler handler)
Sets, edits or deletes an unversioned revision property. This method uses a Working Copy item to obtain the URL of the repository which revision properties are to be changed.

To set or edit a property simply provide a propName and a propValue. To delete a revision property set propValue to null and the property propName will be deleted.

Parameters: path a Working Copy item revision a revision which properties are to be modified propName a property name propValue a property value force true to force the operation to run handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient SVNWCClient SVNWCClient

doSetRevisionProperty

public void doSetRevisionProperty(SVNURL url, SVNRevision revision, String propName, String propValue, boolean force, ISVNPropertyHandler handler)
Sets, edits or deletes an unversioned revision property. This method uses a URL pointing to a repository which revision properties are to be changed.

To set or edit a property simply provide a propName and a propValue. To delete a revision property set propValue to null and the property propName will be deleted.

Parameters: url a URL pointing to a repository location revision a revision which properties are to be modified propName a property name propValue a property value force true to force the operation to run handler a caller's property handler

Throws: SVNException if one of the following is true:

See Also: SVNWCClient SVNWCClient SVNWCClient SVNWCClient

doUnlock

public void doUnlock(File[] paths, boolean breakLock)
Unlocks file items in a Working Copy as well as in a repository.

Parameters: paths an array of local WC file paths that should be unlocked breakLock if true and there are locks that belong to different users then those locks will be also unlocked - that is "broken"

Throws: SVNException if one of the following is true:

See Also: (SVNURL[], boolean)

doUnlock

public void doUnlock(SVNURL[] urls, boolean breakLock)
Unlocks file items in a repository.

Parameters: urls an array of URLs that should be unlocked breakLock if true and there are locks that belong to different users then those locks will be also unlocked - that is "broken"

Throws: SVNException

See Also: (File[], boolean)

getAddParameters

protected ISVNAddParameters getAddParameters()

setAddParameters

public void setAddParameters(ISVNAddParameters addParameters)
Copyright © 2004-2007 TMate Software Ltd. All Rights Reserved.