Package org.tmatesoft.svn.core.wc2
Class SvnCopy
- java.lang.Object
-
- org.tmatesoft.svn.core.wc2.SvnOperation<java.lang.Void>
-
- org.tmatesoft.svn.core.wc2.SvnCopy
-
- All Implemented Interfaces:
ISvnOperationOptionsProvider
public class SvnCopy extends SvnOperation<java.lang.Void>
Represents copy operation. Copies each source insources
to operation'starget
representing working copy path, or converts a disjoint working copy to a copied one, or does virtual copy (see below).-
If
disjoint
andvirtual
arefalse
: If multiplesources
are given,target
must be a directory, andsources
will be copied as children of directory. Eachsrc
insources
must be files or directories under version control, or URLs of a versioned item in the repository. Ifsources
has multiple items, they must be all repository URLs or all working copy paths. The parent oftarget
must already exist. Ifsources
has only one item, attempts to copy it totarget
. IffailWhenDstExists
isfalse
andtarget
already exists, attempts to copy the item as a child oftarget
. IffailWhenDstExists
istrue
andtarget
already exists, throws anSVNException
with theSVNErrorCode.FS_ALREADY_EXISTS
error code. Ifsources
has multiple items, andfailWhenDstExists
isfalse
, allsources
are copied as children oftarget
. If any child oftarget
already exists with the same name any item insources
, throws anSVNException
with theSVNErrorCode.FS_ALREADY_EXISTS
error code. Ifsources
has multiple items, andfailWhenDstExists
istrue
, throws anSVNException
with theSVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED
. If the caller'sISVNEventHandler
is non-null
, invokes it for each item added at the new location. This method is just a variant of a local add operation, wheresources
are scheduled for addition as copies. No changes will happen to the repository until a commit occurs. This scheduling can be removed withSvnRevert
. Note: this routine requires repository access only when sources are URLs. -
If
disjoint
istrue
:Targets
represent the roots of the working copies located in another working copies. This copy operation uses onlysources
as operation's parameters. Note: this routine does not require repository access. However if it's performed on an old format working copy where repository root urls were not written, the routine will connect to the repository to fetch the repository root urls.SvnOperation.run()
throwsSVNException
in the following cases:-
exception with
SVNErrorCode.UNSUPPORTED_FEATURE
error code - iftarget
is either not a directory, or has no parent at all; if the current local filesystem parent oftarget
is actually a child of it in the repository exception withSVNErrorCode.ENTRY_EXISTS
error code - iftarget
is not a disjoint working copy, i.e. there is already a versioned item under the parent path oftarget
; iftarget
is not in the repository yet (has got a schedule for addition flag) exception withSVNErrorCode.WC_INVALID_SCHEDULE
error code - iftarget
is not from the same repository as the parent directory; if the parent oftarget
is scheduled for deletion; iftarget
is scheduled for deletion -
If
virtual
istrue
: Copies/moves administrative version control information of a source files to administrative information of a destination file. For example, if you have manually copied/moved a source files to atarget
one (manually means just in the filesystem, not using version control operations) and then would like to turn this copying/moving into a complete version control copy or move operation, use this method that will finish all the work for you - it will copy/move all the necessary administrative information (kept in the source .svn directory) to thetarget
.svn directory.In that case when you have your files copied/moved in the filesystem, you can not perform standard (version control) copying/moving - since the
This operation usestarget
already exists and the source may be already deleted. Use this method to overcome that restriction.sources
andmove
parameters. Ifmove
istrue
then completes movingsrc
totarget
, otherwise completes copyingsrc
todst
SvnOperation.run()
throwsSVNException
if one of the following is true:move = true
andsrc
still existstarget
does not existtarget
is a directorysrc
is a directorysrc
is not under version controltarget
is already under version control- if
src
is copied but not scheduled for addition, and SVNKit is not able to locate the copied directory root forsrc
- Version:
- 1.7
- Author:
- TMate Software Ltd.
- See Also:
SvnCopySource
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SvnCopy(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCopySource(SvnCopySource source)
Adds copy source information to the operationjava.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>>
getExternalsToPin()
java.util.Collection<SvnCopySource>
getSources()
Returns operation's all copy sources, object containing information about what to copy.boolean
isAllowMixedRevisions()
Gets whether the coping of directories with mixed revisions is allowedboolean
isChangesWorkingCopy()
Gets whether the operation changes working copyboolean
isDisjoint()
Returns whether copy is disjoint working copy.boolean
isFailWhenDstExists()
Gets whether to fail iftarget
already exists.boolean
isIgnoreExternals()
Returns whether to ignore externals definitions.boolean
isMakeParents()
Gets whether to make parent folders if don't exist.boolean
isMetadataOnly()
boolean
isMove()
Gets whether to do copy as move operation (delete, then add with history).boolean
isPinExternals()
boolean
isVirtual()
Returns whether copy is virtual copy.void
setAllowMixedRevisions(boolean allowMixedRevisions)
Sets whether the coping of directories with mixed revisions is allowedvoid
setDisjoint(boolean disjoint)
Sets whether copy is disjoint working copy.void
setExternalsToPin(java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>> externalsToPin)
void
setFailWhenDstExists(boolean isFailWhenDstExist)
Sets whether to fail iftarget
already exists.void
setIgnoreExternals(boolean ignoreExternals)
Sets whether to ignore externals definitions.void
setMakeParents(boolean isMakeParents)
Sets whether to make parent folders if don't exist.void
setMetadataOnly(boolean metadataOnly)
void
setMove(boolean isMove)
Sets whether to do copy as move operation (delete, then add with history).void
setPinExternals(boolean pinExternals)
void
setVirtual(boolean virtual)
Sets whether copy is virtual copy.-
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation
addTarget, cancel, ensureArgumentsAreValid, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMaximumTargetsCount, getMinimumTargetsCount, getOperationalWorkingCopy, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, initDefaults, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, run, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
-
-
-
-
Constructor Detail
-
SvnCopy
protected SvnCopy(SvnOperationFactory factory)
-
-
Method Detail
-
getSources
public java.util.Collection<SvnCopySource> getSources()
Returns operation's all copy sources, object containing information about what to copy.- Returns:
- the copy sources of the operation, unmodifiable
-
addCopySource
public void addCopySource(SvnCopySource source)
Adds copy source information to the operation- Parameters:
source
- copy source information
-
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 isMove)
Sets whether to do copy as move operation (delete, then add with history).- Parameters:
isMove
-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 isMakeParents)
Sets whether to make parent folders if don't exist.- Parameters:
isMakeParents
-true
if non-existent parent directories should be created, otherwisefalse
-
isFailWhenDstExists
public boolean isFailWhenDstExists()
Gets whether to fail iftarget
already exists.- Returns:
true
if fail whentarget
already exists, otherwisefalse
- See Also:
SvnRemoteCopy
-
setFailWhenDstExists
public void setFailWhenDstExists(boolean isFailWhenDstExist)
Sets whether to fail iftarget
already exists.- Parameters:
isFailWhenDstExist
-true
if fail whentarget
already exists, otherwisefalse
- See Also:
SvnRemoteCopy
-
isIgnoreExternals
public boolean isIgnoreExternals()
Returns whether to ignore externals definitions.- Returns:
true
if externals definitions should be ignored, otherwisefalse
-
setIgnoreExternals
public void setIgnoreExternals(boolean ignoreExternals)
Sets whether to ignore externals definitions.- Parameters:
ignoreExternals
-true
if externals definitions should be ignored, otherwisefalse
-
isVirtual
public boolean isVirtual()
Returns whether copy is virtual copy.- Returns:
true
if it is virtual copy, otherwisefalse
-
setVirtual
public void setVirtual(boolean virtual)
Sets whether copy is virtual copy.- Parameters:
virtual
-true
if it is virtual copy, otherwisefalse
-
isDisjoint
public boolean isDisjoint()
Returns whether copy is disjoint working copy.- Returns:
true
if it is disjoint working copy, otherwisefalse
-
setDisjoint
public void setDisjoint(boolean disjoint)
Sets whether copy is disjoint working copy.- Parameters:
disjoint
-true
if it is disjoint working copy, otherwisefalse
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopy
in classSvnOperation<java.lang.Void>
- Returns:
true
if the operation changes the working copy, otherwisefalse
-
isAllowMixedRevisions
public boolean isAllowMixedRevisions()
Gets whether the coping of directories with mixed revisions is allowed- Returns:
true
if coping of directories with mixed revisions is allowed
-
setAllowMixedRevisions
public void setAllowMixedRevisions(boolean allowMixedRevisions)
Sets whether the coping of directories with mixed revisions is allowed- Parameters:
allowMixedRevisions
-true
if coping of directories with mixed revisions is allowed
-
isMetadataOnly
public boolean isMetadataOnly()
-
setMetadataOnly
public void setMetadataOnly(boolean metadataOnly)
-
isPinExternals
public boolean isPinExternals()
-
setPinExternals
public void setPinExternals(boolean pinExternals)
-
getExternalsToPin
public java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>> getExternalsToPin()
-
setExternalsToPin
public void setExternalsToPin(java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>> externalsToPin)
-
-