Package org.tmatesoft.svn.core.wc2
Class SvnRemoteCopy
java.lang.Object
org.tmatesoft.svn.core.wc2.SvnOperation<T>
org.tmatesoft.svn.core.wc2.SvnReceivingOperation<SVNCommitInfo>
org.tmatesoft.svn.core.wc2.AbstractSvnCommit
org.tmatesoft.svn.core.wc2.SvnRemoteCopy
- All Implemented Interfaces:
ISvnObjectReceiver<SVNCommitInfo>
,ISvnOperationOptionsProvider
Represents copy to repository operation.
Copies each source in
sources
to operation's target
destination.
Target
should represent repository URL.
If multiple sources
are given, target
must be a
directory, and sources
will be copied as children of
target
.
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 target
must already exist.
If sources
has only one item, attempts to copy it to
target
. If failWhenDstExists
is false
and target
already exists,
attempts to copy the item as a child of target
If
failWhenDstExists
is true
and target
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 target
. If
any child of target
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 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 subdirectories 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 no more 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.
run()
returns SVNCommitInfo
commit information information about the new committed revision.- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ISvnCommitParameters
private boolean
private ISvnExternalsHandler
private Map<SvnTarget,
List<SVNExternal>> private boolean
private boolean
private boolean
private boolean
private Collection<SvnCopySource>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCopySource
(SvnCopySource source) And one source to the operation's sources.Returns operation's parameters of the commit.Gets operation's externals handler.protected File
Returns all operation's sources.boolean
Gets whether the operation changes working copyboolean
Sets whether to disable local modifications.boolean
Gets whether to fail iftarget
already exists.boolean
Gets whether to make parent folders if don't exist.boolean
isMove()
Gets whether to do copy as move operation (delete, then add with history).boolean
run()
Runs copy operation.void
setCommitParameters
(ISvnCommitParameters commitParameters) Sets operation's parameters of the commit.void
setDisableLocalModifications
(boolean disableLocalModifications) Sets whether to disable local modifications.void
setExternalsHandler
(ISvnExternalsHandler externalsHandler) Sets operation's externals handler.void
setExternalsToPin
(Map<SvnTarget, List<SVNExternal>> externalsToPin) void
setFailWhenDstExists
(boolean failWhenDstExists) Sets whether to fail iftarget
already exists.void
setMakeParents
(boolean makeParents) Sets whether to make parent folders if don't exist.void
setMove
(boolean move) Sets whether to do copy as move operation (delete, then add with history).void
setPinExternals
(boolean pinExternals) Methods inherited from class org.tmatesoft.svn.core.wc2.AbstractSvnCommit
getCommitHandler, getCommitMessage, getRevisionProperties, setCommitHandler, setCommitMessage, setRevisionProperties, setRevisionProperty
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnReceivingOperation
first, getReceiver, initDefaults, last, receive, run, setReceiver
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation
addTarget, cancel, ensureArgumentsAreValid, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMaximumTargetsCount, getMinimumTargetsCount, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
-
Field Details
-
move
private boolean move -
makeParents
private boolean makeParents -
failWhenDstExists
private boolean failWhenDstExists -
externalsHandler
-
commitParameters
-
disableLocalModifications
private boolean disableLocalModifications -
pinExternals
private boolean pinExternals -
externalsToPin
-
sources
-
-
Constructor Details
-
SvnRemoteCopy
-
-
Method Details
-
isMove
public boolean isMove()Gets whether to do copy as move operation (delete, then add with history).- Returns:
true
if move operation should be done, otherwisefalse
-
setMove
public void setMove(boolean move) Sets whether to do copy as move operation (delete, then add with history).- Parameters:
move
-true
if move operation should be done, otherwisefalse
-
isMakeParents
public boolean isMakeParents()Gets whether to make parent folders if don't exist.- Returns:
true
if non-existent parent directories should be created, otherwisefalse
-
setMakeParents
public void setMakeParents(boolean makeParents) Sets whether to make parent folders if don't exist.- Parameters:
makeParents
-true
if non-existent parent directories should be created, otherwisefalse
-
isDisableLocalModifications
public boolean isDisableLocalModifications()Sets whether to disable local modifications.- Returns:
true
if local modifications are disabled, otherwisefalse
- See Also:
-
setDisableLocalModifications
public void setDisableLocalModifications(boolean disableLocalModifications) Sets whether to disable local modifications. Iftrue
and any local modification is found,run()
method throwsSVNException
exception withSVNErrorCode.ILLEGAL_TARGET
code.- Parameters:
disableLocalModifications
-true
if local modifications are disabled, otherwisefalse
-
getSources
Returns all operation's sources.- Returns:
- sources of the operation
- See Also:
-
addCopySource
And one source to the operation's sources.- Parameters:
source
- source of the operation- See Also:
-
isFailWhenDstExists
public boolean isFailWhenDstExists()Gets whether to fail iftarget
already exists.- Returns:
true
if fail whentarget
already exists, otherwisefalse
- See Also:
-
setFailWhenDstExists
public void setFailWhenDstExists(boolean failWhenDstExists) Sets whether to fail iftarget
already exists.- Parameters:
failWhenDstExists
-true
if fail whentarget
already exists, otherwisefalse
- See Also:
-
run
Runs copy operation.- Overrides:
run
in classSvnOperation<SVNCommitInfo>
- Returns:
SVNCommitInfo
commit information information about the new committed revision.- Throws:
SVNException
-
getExternalsHandler
Gets operation's externals handler.- Returns:
- externals handler of the operation
- See Also:
-
setExternalsHandler
Sets operation's externals handler.- Parameters:
externalsHandler
- externals handler of the operation- See Also:
-
getCommitParameters
Returns operation's parameters of the commit. If no user parameters were previously specified, once creates and returnsdefault
ones.- Returns:
- commit parameters of the operation
- See Also:
-
setCommitParameters
Sets operation's parameters of the commit. When no parameters are setdefault
ones are used.- Parameters:
commitParameters
- commit parameters of the operation- See Also:
-
isPinExternals
public boolean isPinExternals() -
setPinExternals
public void setPinExternals(boolean pinExternals) -
getExternalsToPin
-
setExternalsToPin
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopy
in classSvnOperation<SVNCommitInfo>
- Returns:
true
if the operation changes the working copy, otherwisefalse
-
getOperationalWorkingCopy
- Overrides:
getOperationalWorkingCopy
in classSvnOperation<SVNCommitInfo>
-