Class SvnJavaUtil
- java.lang.Object
-
- org.apache.maven.scm.provider.svn.svnjava.util.SvnJavaUtil
-
public final class SvnJavaUtil extends Object
* Static helper library to consolidate calls to theSVNWCClient
. The procedure comments were taken from the tmate.org example file: org.tmatesoft.svn.examples.wc.WorkingCopy.java- Version:
- $Id: SvnJavaUtil.java 491 2011-01-09 14:24:51Z oliver.lamy $
- Author:
- David Hawkins
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SvnJavaUtil.GenericEventHandler
Generic event handler that collects all events internally and will return them with a call toSvnJavaUtil.GenericEventHandler.getEvents()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean recursive)
static void
add(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean recursive, boolean force)
Puts directories and files under version control scheduling them for addition to a repository.static void
blame(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File file, org.tmatesoft.svn.core.wc.ISVNAnnotateHandler handler)
static void
changelog(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL svnUrl, org.tmatesoft.svn.core.wc.SVNRevision startRevision, org.tmatesoft.svn.core.wc.SVNRevision endRevision, boolean stopOnCopy, boolean reportPaths, org.tmatesoft.svn.core.ISVNLogEntryHandler handler)
static long
checkout(org.tmatesoft.svn.core.wc.SVNUpdateClient updateClient, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision, File destPath, boolean isRecursive)
Checks out a working copy from a repository.static org.tmatesoft.svn.core.SVNCommitInfo
commit(org.tmatesoft.svn.core.wc.SVNCommitClient clientManager, File[] paths, boolean keepLocks, String commitMessage, boolean recursive)
Commits changes in a working copy to a repository.static org.tmatesoft.svn.core.SVNCommitInfo
copy(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File srcPath, org.tmatesoft.svn.core.SVNURL dstURL, boolean isMove, String commitMessage, String revision)
static org.tmatesoft.svn.core.SVNCommitInfo
copy(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL srcURL, org.tmatesoft.svn.core.SVNURL dstURL, boolean isMove, String commitMessage, String revision)
static void
delete(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.apache.maven.scm.ScmFileSet fileSet, boolean force)
Schedules directories and files for deletion from version control upon the next commit (locally).static ByteArrayOutputStream
diff(org.tmatesoft.svn.core.wc.SVNDiffClient diffClient, File baseDir, org.tmatesoft.svn.core.wc.SVNRevision startRevision, org.tmatesoft.svn.core.wc.SVNRevision endRevision, org.tmatesoft.svn.core.SVNDepth depth, Collection<String> changeLists)
static long
export(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision, File destPath, boolean isRecursive)
static org.apache.maven.scm.ScmFileStatus
getScmFileStatus(org.tmatesoft.svn.core.wc.SVNEventAction action)
Converts aSVNEventAction
to aScmFileStatus
static org.tmatesoft.svn.core.SVNCommitInfo
mkdir(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL[] urls, String commitMessage)
static void
status(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean isRecursive, boolean isRemote, SvnStatusHandler handler)
Collects status information on local path(s).static long
switchToURL(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision updateToRevision, boolean isRecursive)
Updates a working copy to a different URL.static long
update(org.tmatesoft.svn.core.wc.SVNUpdateClient updateClient, File wcPath, org.tmatesoft.svn.core.wc.SVNRevision updateToRevision, boolean isRecursive)
Updates a working copy (brings changes from the repository into the working copy).
-
-
-
Method Detail
-
getScmFileStatus
public static org.apache.maven.scm.ScmFileStatus getScmFileStatus(org.tmatesoft.svn.core.wc.SVNEventAction action)
Converts aSVNEventAction
to aScmFileStatus
-
add
public static void add(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean recursive) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
add
public static void add(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean recursive, boolean force) throws org.tmatesoft.svn.core.SVNException
Puts directories and files under version control scheduling them for addition to a repository. They will be added in a next commit. Like 'svn add PATH' command. It's done by invokingSVNWCClient.doAdd(File path, boolean force, boolean mkdir, boolean climbUnversionedParents, boolean recursive)
which takes the following parameters:
path - an entry to be scheduled for addition;
force - set to true to force an addition of an entry anyway;
mkdir - if true doAdd(..) creates an empty directory at path and schedules it for addition, like 'svn mkdir PATH' command;
climbUnversionedParents - if true and the parent of the entry to be scheduled for addition is not under version control, then doAdd(..) automatically schedules the parent for addition, too;
recursive - if true and an entry is a directory then doAdd(..) recursively schedules all its inner dir entries for addition as well.- Throws:
org.tmatesoft.svn.core.SVNException
-
checkout
public static long checkout(org.tmatesoft.svn.core.wc.SVNUpdateClient updateClient, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision, File destPath, boolean isRecursive) throws org.tmatesoft.svn.core.SVNException
Checks out a working copy from a repository. Like 'svn checkout URL[@REV] PATH (-r..)' command; It's done by invokingSVNUpdateClient.doCheckout(SVNURL url, File dstPath, SVNRevision pegRevision, SVNRevision revision, boolean recursive)
which takes the following parameters:
url - a repository location from where a working copy is to be checked out;
dstPath - a local path where the working copy will be fetched into;
pegRevision - an SVNRevision representing a revision to concretize url (what exactly URL a user means and is sure of being the URL he needs); in other words that is the revision in which the URL is first looked up;
revision - a revision at which a working copy being checked out is to be;
recursive - if true and url corresponds to a directory then doCheckout(..) recursively fetches out the entire directory, otherwise - only child entries of the directory;- Throws:
org.tmatesoft.svn.core.SVNException
-
export
public static long export(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision, File destPath, boolean isRecursive) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
switchToURL
public static long switchToURL(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision updateToRevision, boolean isRecursive) throws org.tmatesoft.svn.core.SVNException
Updates a working copy to a different URL. Like 'svn switch URL' command. It's done by invokingSVNUpdateClient.doSwitch(File file, SVNURL url, SVNRevision revision, boolean recursive)
which takes the following parameters:
file - a working copy entry that is to be switched to a new url;
url - a target URL a working copy is to be updated against;
revision - a revision to which a working copy is to be updated;
recursive - if true and an entry (file) is a directory then doSwitch(..) recursively switches the entire directory, otherwise - only child entries of the directory;- Throws:
org.tmatesoft.svn.core.SVNException
-
update
public static long update(org.tmatesoft.svn.core.wc.SVNUpdateClient updateClient, File wcPath, org.tmatesoft.svn.core.wc.SVNRevision updateToRevision, boolean isRecursive) throws org.tmatesoft.svn.core.SVNException
Updates a working copy (brings changes from the repository into the working copy). Like 'svn update PATH' command; It's done by invokingSVNUpdateClient.doUpdate(File file, SVNRevision revision, boolean recursive)
which takes the following parameters:
file - a working copy entry that is to be updated;
revision - a revision to which a working copy is to be updated;
recursive - if true and an entry is a directory then doUpdate(..) recursively updates the entire directory, otherwise - only child entries of the directory;- Throws:
org.tmatesoft.svn.core.SVNException
-
changelog
public static void changelog(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL svnUrl, org.tmatesoft.svn.core.wc.SVNRevision startRevision, org.tmatesoft.svn.core.wc.SVNRevision endRevision, boolean stopOnCopy, boolean reportPaths, org.tmatesoft.svn.core.ISVNLogEntryHandler handler) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
commit
public static org.tmatesoft.svn.core.SVNCommitInfo commit(org.tmatesoft.svn.core.wc.SVNCommitClient clientManager, File[] paths, boolean keepLocks, String commitMessage, boolean recursive) throws org.tmatesoft.svn.core.SVNException
Commits changes in a working copy to a repository. Like 'svn commit PATH -m "some comment"' command. It's done by invokingSVNCommitClient.doCommit(File[] paths, boolean keepLocks, String commitMessage, boolean force, boolean recursive)
which takes the following parameters:
paths - working copy paths which changes are to be committed;
keepLocks - if true then doCommit(..) won't unlock locked paths; otherwise they will be unlocked after a successful commit;
commitMessage - a commit log message;
force - if true then a non-recursive commit will be forced anyway;
recursive - if true and a path corresponds to a directory then doCommit(..) recursively commits changes for the entire directory, otherwise - only for child entries of the directory;- Throws:
org.tmatesoft.svn.core.SVNException
-
delete
public static void delete(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.apache.maven.scm.ScmFileSet fileSet, boolean force) throws org.tmatesoft.svn.core.SVNException
Schedules directories and files for deletion from version control upon the next commit (locally). Like 'svn delete PATH' command. It's done by invokingSVNWCClient.doDelete(File path, boolean force, boolean dryRun)
which takes the following parameters:
path - an entry to be scheduled for deletion;
force - a boolean flag which is set to true to force a deletion even if an entry has local modifications;
dryRun - set to true not to delete an entry but to check if it can be deleted; if false - then it's a deletion itself.- Throws:
org.tmatesoft.svn.core.SVNException
-
status
public static void status(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File wcPath, boolean isRecursive, boolean isRemote, SvnStatusHandler handler) throws org.tmatesoft.svn.core.SVNException
Collects status information on local path(s). Like 'svn status (-u) (-N)' command. It's done by invokingSVNStatusClient.doStatus(File path, boolean recursive, boolean remote, boolean reportAll, boolean includeIgnored, boolean collectParentExternals, ISVNStatusHandler handler)
which takes the following parameters:
path - an entry which status info to be gathered;
recursive - if true and an entry is a directory then doStatus(..) collects status info not only for that directory but for each item inside stepping down recursively;
remote - if true then doStatus(..) will cover the repository (not only the working copy) as well to find out what entries are out of date;
reportAll - if true then doStatus(..) will also include unmodified entries;
includeIgnored - if true then doStatus(..) will also include entries being ignored;
collectParentExternals - if true then externals definitions won't be ignored;
handler - an implementation of ISVNStatusHandler to process status info per each entry doStatus(..) traverses; such info is collected in an SVNStatus object and is passed to a handler's handleStatus(SVNStatus status) method where an implementor decides what to do with it.- Throws:
org.tmatesoft.svn.core.SVNException
-
copy
public static org.tmatesoft.svn.core.SVNCommitInfo copy(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL srcURL, org.tmatesoft.svn.core.SVNURL dstURL, boolean isMove, String commitMessage, String revision) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
copy
public static org.tmatesoft.svn.core.SVNCommitInfo copy(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File srcPath, org.tmatesoft.svn.core.SVNURL dstURL, boolean isMove, String commitMessage, String revision) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
diff
public static ByteArrayOutputStream diff(org.tmatesoft.svn.core.wc.SVNDiffClient diffClient, File baseDir, org.tmatesoft.svn.core.wc.SVNRevision startRevision, org.tmatesoft.svn.core.wc.SVNRevision endRevision, org.tmatesoft.svn.core.SVNDepth depth, Collection<String> changeLists) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
blame
public static void blame(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, File file, org.tmatesoft.svn.core.wc.ISVNAnnotateHandler handler) throws org.tmatesoft.svn.core.SVNException
- Parameters:
clientManager
-file
-- Throws:
org.tmatesoft.svn.core.SVNException
- Since:
- 1.10
-
mkdir
public static org.tmatesoft.svn.core.SVNCommitInfo mkdir(org.tmatesoft.svn.core.wc.SVNClientManager clientManager, org.tmatesoft.svn.core.SVNURL[] urls, String commitMessage) throws org.tmatesoft.svn.core.SVNException
- Throws:
org.tmatesoft.svn.core.SVNException
-
-