|
SVNKit Home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.tmatesoft.svn.core.wc.SVNBasicClient
org.tmatesoft.svn.core.internal.wc.SVNCopyDriver
org.tmatesoft.svn.core.wc.SVNCopyClient
public class SVNCopyClient
The SVNCopyClient provides methods to perform any kinds of copying and moving that SVN supports - operating on both Working Copies (WC) and URLs.
Copy operations allow a user to copy versioned files and directories with all their previous history in several ways.
Supported copy operations are:
Besides just copying SVNCopyClient also is able to move a versioned item - that is first making a copy of the source item and then scheduling the source item for deletion when operating on a Working Copy, or right committing the deletion of the source item when operating immediately on the repository.
Supported move operations are:
Overloaded doCopy() methods of SVNCopyClient are similar to
'svn copy'
and 'svn move'
commands of the SVN command line client.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.tmatesoft.svn.core.wc.SVNBasicClient |
---|
SVNBasicClient.RepositoryReference, SVNBasicClient.SVNRepositoryLocation |
Field Summary | |
---|---|
protected ISVNCommitHandler |
myCommitHandler
|
protected ISVNCommitParameters |
myCommitParameters
|
protected ISVNExternalsHandler |
myExternalsHandler
|
Fields inherited from interface org.tmatesoft.svn.core.wc.ISVNEventHandler |
---|
UNKNOWN |
Fields inherited from interface org.tmatesoft.svn.core.ISVNCanceller |
---|
NULL |
Constructor Summary | |
---|---|
SVNCopyClient(ISVNAuthenticationManager authManager,
ISVNOptions options)
Constructs and initializes an SVNCopyClient object with the specified run-time configuration and authentication drivers. |
|
SVNCopyClient(ISVNRepositoryPool repositoryPool,
ISVNOptions options)
Constructs and initializes an SVNCopyClient object with the specified run-time configuration and repository pool object. |
Method Summary | |
---|---|
void |
doCopy(File nestedWC)
Converts a disjoint working copy to a copied one. |
void |
doCopy(SVNCopySource[] sources,
File dst,
boolean isMove,
boolean makeParents,
boolean failWhenDstExists)
Copies each source in sources to dst . |
SVNCommitInfo |
doCopy(SVNCopySource[] sources,
SVNURL dst,
boolean isMove,
boolean makeParents,
boolean failWhenDstExists,
String commitMessage,
SVNProperties revisionProperties)
Copies each source in sources to dst . |
ISVNCommitHandler |
getCommitHandler()
Returns the specified commit handler (if set) being in use or a default one (DefaultSVNCommitHandler) if no special implementations of ISVNCommitHandler were previousely provided. |
ISVNCommitParameters |
getCommitParameters()
Returns commit parameters. |
ISVNExternalsHandler |
getExternalsHandler()
Returns an externals handler used by this update client. |
void |
setCommitHandler(ISVNCommitHandler handler)
Sets an implementation of ISVNCommitHandler to the commit handler that will be used during commit operations to handle commit log messages. |
void |
setCommitParameters(ISVNCommitParameters parameters)
Sets commit parameters to use. |
void |
setExternalsHandler(ISVNExternalsHandler externalsHandler)
Sets an externals handler to be used by this client object. |
Methods inherited from class org.tmatesoft.svn.core.internal.wc.SVNCopyDriver |
---|
copyDisjointWCToWC, expandCopySources, setupCopy, setWCAccess |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected ISVNCommitHandler myCommitHandler
protected ISVNCommitParameters myCommitParameters
protected ISVNExternalsHandler myExternalsHandler
Constructor Detail |
---|
public SVNCopyClient(ISVNAuthenticationManager authManager, ISVNOptions options)
If options
is null,
then this SVNCopyClient 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 SVNCopyClient will be using a default authentication
and network layers driver (see SVNWCUtil.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).
authManager
- an authentication and network layers driveroptions
- a run-time configuration options driverpublic SVNCopyClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
options
is null,
then this SVNCopyClient 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 repositoryPool
is null,
then SVNRepositoryFactory
will be used to create repository access objects
.
repositoryPool
- a repository pool objectoptions
- a run-time configuration options driverMethod Detail |
---|
public void setCommitHandler(ISVNCommitHandler handler)
If using SVNCopyClient without specifying any
commit handler then a default one will be used - DefaultSVNCommitHandler
.
handler
- an implementor's handler that will be used to handle
commit log messagesgetCommitHandler()
,
SVNCommitItem
public ISVNCommitHandler getCommitHandler()
setCommitHandler(ISVNCommitHandler)
,
DefaultSVNCommitHandler
public void setCommitParameters(ISVNCommitParameters parameters)
When no parameters are set default
ones are used.
parameters
- commit parametersgetCommitParameters()
public ISVNCommitParameters getCommitParameters()
If no user parameters were previously specified, once creates and
returns default
ones.
setCommitParameters(ISVNCommitParameters)
public void setExternalsHandler(ISVNExternalsHandler externalsHandler)
externalsHandler
- user's implementation of ISVNExternalsHandler
getExternalsHandler()
public ISVNExternalsHandler getExternalsHandler()
ISVNExternalsHandler.DEFAULT
is returned and
used by this client object by default.
For more information what externals handlers are for, please, refer to ISVNExternalsHandler
and
doCopy(SVNCopySource[], SVNURL, boolean, boolean, boolean, String, SVNProperties)
.
setExternalsHandler(ISVNExternalsHandler)
public void doCopy(SVNCopySource[] sources, File dst, boolean isMove, boolean makeParents, boolean failWhenDstExists) throws SVNException
sources
to dst
.
If multiple sources
are given, dst
must be a directory, and sources
will be copied as children of dst
.
Each src
in sources
must be files or directories under version control,
or URLs of a versioned item in the repository. If sources
has multiple items, they
must be all repository URLs or all working copy paths.
The parent of dst
must already exist.
If sources
has only one item, attempts to copy it to dst
.
If failWhenDstExists
is false and dst
already
exists, attempts to copy the item as a child of dst
. If failWhenDstExists
is
true and dst
already exists, throws an SVNException
with the SVNErrorCode.ENTRY_EXISTS
error code.
If sources
has multiple items, and failWhenDstExists
is
false, all sources
are copied as children of dst
.
If any child of dst
already exists with the same name any item in sources
,
throws an SVNException
with the SVNErrorCode.ENTRY_EXISTS
error code.
If sources
has multiple items, and failWhenDstExists
is
true, throws an SVNException
with the
SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED
.
This method is just a variant of a local add operation, where sources
are scheduled for
addition as copies. No changes will happen to the repository until a commit occurs. This scheduling can
be removed with SVNWCClient.doRevert(File[], SVNDepth, Collection)
.
If makeParents is true, creates any non-existent parent directories
also.
If the caller's ISVNEventHandler
is non-null, invokes it
for each item added at the new location.
Note: this routine requires repository access only when sources are urls.
- Parameters:
sources
- array of copy sourcesdst
- destination working copy pathisMove
- if true, then it will be a move operation
(delete, then add with history)makeParents
- if true, creates non-existent parent
directories as wellfailWhenDstExists
- controls whether to fail or not if dst
already exists
- Throws:
SVNException
- Since:
- 1.2, SVN 1.5
public SVNCommitInfo doCopy(SVNCopySource[] sources, SVNURL dst, boolean isMove, boolean makeParents, boolean failWhenDstExists, String commitMessage, SVNProperties revisionProperties) throws SVNException
sources
to dst
.
If multiple sources
are given, dst
must be a directory, and sources
will be copied as children of dst
.
Each src
in sources
must be files or directories under version control,
or URLs of a versioned item in the repository. If sources
has multiple items, they
must be all repository URLs or all working copy paths.
The parent of dst
must already exist.
If sources
has only one item, attempts to copy it to dst
.
If failWhenDstExists
is false and dst
already
exists, attempts to copy the item as a child of dst
. If failWhenDstExists
is
true and dst
already exists, throws an SVNException
with the SVNErrorCode.FS_ALREADY_EXISTS
error code.
If sources
has multiple items, and failWhenDstExists
is
false, all sources
are copied as children of dst
.
If any child of dst
already exists with the same name any item in sources
,
throws an SVNException
with the SVNErrorCode.FS_ALREADY_EXISTS
error code.
If sources
has multiple items, and failWhenDstExists
is
true, throws an SVNException
with the
SVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED
.
Authentication manager
(whether provided directly through the
appropriate constructor or in an ISVNRepositoryPool
instance) and commit handler
are used to immediately attempt to commit the copy action in the repository.
If makeParents is true, creates any non-existent parent directories
also.
If non-null, revisionProperties
is an object holding
additional, custom revision properties (String
to SVNPropertyValue
mappings) to be
set on the new revision. This table cannot contain any standard Subversion properties.
If the caller's ISVNEventHandler
is non-null, invokes it
for each item added at the new location.
When performing a wc-to-url copy (tagging|branching from a working copy) it's possible to fix
revisions of external working copies (if any) which are located within the working copy being copied.
For example, imagine you have a working copy and on one of its subdirecotries you set an
"svn:externals" property which does not contain a revision number.
Suppose you have made a tag from your working copy and in some period of time a user checks out
that tag. It could have happened that the external project has evolved since the tag creation moment
and the tag version is nomore compatible with it. So, the user has a broken project since it will not
compile because of the API incompatibility between the two versions of the external project: the HEAD
one and the one existed in the moment of the tag creation. That is why it appears useful to fix externals
revisions during a wc-to-url copy. To enable externals revision fixing a user should implement
ISVNExternalsHandler
. The user's implementation
ISVNExternalsHandler.handleExternal(File, SVNURL, SVNRevision, SVNRevision, String, SVNRevision)
method will be called on every external that will be met in the working copy. If the user's implementation
returns non-null external revision, it's compared with the revisions
fetched from the external definition. If they are different, the user's revision will be written in
the external definition of the tag. Otherwise if the returned revision is equal to the revision from
the external definition or if the user's implementation returns null for
that external, it will be skipped (i.e. left as is, unprocessed).
Note: this routine requires repository access.
- Parameters:
sources
- array of copy sourcesdst
- destination urlisMove
- if true, then it will be a move operation
(delete, then add with history)makeParents
- if true, creates non-existent parent
directories as wellfailWhenDstExists
- controls whether to fail or not if dst
already existscommitMessage
- commit log messagerevisionProperties
- custom revision properties
- Returns:
- information about the new committed revision
- Throws:
SVNException
- Since:
- 1.2, SVN 1.5
public void doCopy(File nestedWC) throws SVNException
nestedWC
- the root of the working copy located in another working copy (disjoint wc)
SVNException
- in the following cases:
SVNErrorCode.UNSUPPORTED_FEATURE
error code -
if nestedWC
is either not a directory, or has no parent at all;
if the current local filesystem parent of nestedWC
is actually a
child of it in the repository
exception with SVNErrorCode.ENTRY_EXISTS
error code -
if nestedWC
is not a disjoint working copy, i.e. there is already
a versioned item under the parent path of nestedWC
;
if nestedWC
is not in the repository yet (has got a schedule for
addition flag)
exception with SVNErrorCode.WC_INVALID_SCHEDULE
error code -
if nestedWC
is not from the same repository as the parent directory;
if the parent of nestedWC
is scheduled for deletion;
if nestedWC
is scheduled for deletion
|
SVNKit Home | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |