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 insourcesto operation'stargetrepresenting working copy path, or converts a disjoint working copy to a copied one, or does virtual copy (see below).-
If
disjointandvirtualarefalse: If multiplesourcesare given,targetmust be a directory, andsourceswill be copied as children of directory. Eachsrcinsourcesmust be files or directories under version control, or URLs of a versioned item in the repository. Ifsourceshas multiple items, they must be all repository URLs or all working copy paths. The parent oftargetmust already exist. Ifsourceshas only one item, attempts to copy it totarget. IffailWhenDstExistsisfalseandtargetalready exists, attempts to copy the item as a child oftarget. IffailWhenDstExistsistrueandtargetalready exists, throws anSVNExceptionwith theSVNErrorCode.FS_ALREADY_EXISTSerror code. Ifsourceshas multiple items, andfailWhenDstExistsisfalse, allsourcesare copied as children oftarget. If any child oftargetalready exists with the same name any item insources, throws anSVNExceptionwith theSVNErrorCode.FS_ALREADY_EXISTSerror code. Ifsourceshas multiple items, andfailWhenDstExistsistrue, throws anSVNExceptionwith theSVNErrorCode.CLIENT_MULTIPLE_SOURCES_DISALLOWED. If the caller'sISVNEventHandleris non-null, invokes it for each item added at the new location. This method is just a variant of a local add operation, wheresourcesare 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
disjointistrue:Targetsrepresent the roots of the working copies located in another working copies. This copy operation uses onlysourcesas 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()throwsSVNExceptionin the following cases:-
exception with
SVNErrorCode.UNSUPPORTED_FEATUREerror code - iftargetis either not a directory, or has no parent at all; if the current local filesystem parent oftargetis actually a child of it in the repository exception withSVNErrorCode.ENTRY_EXISTSerror code - iftargetis not a disjoint working copy, i.e. there is already a versioned item under the parent path oftarget; iftargetis not in the repository yet (has got a schedule for addition flag) exception withSVNErrorCode.WC_INVALID_SCHEDULEerror code - iftargetis not from the same repository as the parent directory; if the parent oftargetis scheduled for deletion; iftargetis scheduled for deletion -
If
virtualistrue: 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 atargetone (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 usestargetalready exists and the source may be already deleted. Use this method to overcome that restriction.sourcesandmoveparameters. Ifmoveistruethen completes movingsrctotarget, otherwise completes copyingsrctodstSvnOperation.run()throwsSVNExceptionif one of the following is true:move = trueandsrcstill existstargetdoes not existtargetis a directorysrcis a directorysrcis not under version controltargetis already under version control- if
srcis 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 protectedSvnCopy(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCopySource(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.booleanisAllowMixedRevisions()Gets whether the coping of directories with mixed revisions is allowedbooleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisDisjoint()Returns whether copy is disjoint working copy.booleanisFailWhenDstExists()Gets whether to fail iftargetalready exists.booleanisIgnoreExternals()Returns whether to ignore externals definitions.booleanisMakeParents()Gets whether to make parent folders if don't exist.booleanisMetadataOnly()booleanisMove()Gets whether to do copy as move operation (delete, then add with history).booleanisPinExternals()booleanisVirtual()Returns whether copy is virtual copy.voidsetAllowMixedRevisions(boolean allowMixedRevisions)Sets whether the coping of directories with mixed revisions is allowedvoidsetDisjoint(boolean disjoint)Sets whether copy is disjoint working copy.voidsetExternalsToPin(java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>> externalsToPin)voidsetFailWhenDstExists(boolean isFailWhenDstExist)Sets whether to fail iftargetalready exists.voidsetIgnoreExternals(boolean ignoreExternals)Sets whether to ignore externals definitions.voidsetMakeParents(boolean isMakeParents)Sets whether to make parent folders if don't exist.voidsetMetadataOnly(boolean metadataOnly)voidsetMove(boolean isMove)Sets whether to do copy as move operation (delete, then add with history).voidsetPinExternals(boolean pinExternals)voidsetVirtual(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:
trueif 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-trueif move operation should be done, otherwisefalse
-
isMakeParents
public boolean isMakeParents()
Gets whether to make parent folders if don't exist.- Returns:
trueif 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-trueif non-existent parent directories should be created, otherwisefalse
-
isFailWhenDstExists
public boolean isFailWhenDstExists()
Gets whether to fail iftargetalready exists.- Returns:
trueif fail whentargetalready exists, otherwisefalse- See Also:
SvnRemoteCopy
-
setFailWhenDstExists
public void setFailWhenDstExists(boolean isFailWhenDstExist)
Sets whether to fail iftargetalready exists.- Parameters:
isFailWhenDstExist-trueif fail whentargetalready exists, otherwisefalse- See Also:
SvnRemoteCopy
-
isIgnoreExternals
public boolean isIgnoreExternals()
Returns whether to ignore externals definitions.- Returns:
trueif externals definitions should be ignored, otherwisefalse
-
setIgnoreExternals
public void setIgnoreExternals(boolean ignoreExternals)
Sets whether to ignore externals definitions.- Parameters:
ignoreExternals-trueif externals definitions should be ignored, otherwisefalse
-
isVirtual
public boolean isVirtual()
Returns whether copy is virtual copy.- Returns:
trueif it is virtual copy, otherwisefalse
-
setVirtual
public void setVirtual(boolean virtual)
Sets whether copy is virtual copy.- Parameters:
virtual-trueif it is virtual copy, otherwisefalse
-
isDisjoint
public boolean isDisjoint()
Returns whether copy is disjoint working copy.- Returns:
trueif it is disjoint working copy, otherwisefalse
-
setDisjoint
public void setDisjoint(boolean disjoint)
Sets whether copy is disjoint working copy.- Parameters:
disjoint-trueif it is disjoint working copy, otherwisefalse
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopyin classSvnOperation<java.lang.Void>- Returns:
trueif the operation changes the working copy, otherwisefalse
-
isAllowMixedRevisions
public boolean isAllowMixedRevisions()
Gets whether the coping of directories with mixed revisions is allowed- Returns:
trueif 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-trueif 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)
-
-