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
public class SvnRemoteCopy extends AbstractSvnCommit
Represents copy to repository operation. Copies each source insourcesto operation'stargetdestination.Targetshould represent repository URL. If multiplesourcesare given,targetmust be a directory, andsourceswill be copied as children oftarget. 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 oftargetIffailWhenDstExistsistrueandtargetalready 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.Authentication manager(whether provided directly through the appropriate constructor or in anISVNRepositoryPoolinstance) andcommit handlerare used to immediately attempt to commit the copy action in the repository. If the caller'sISVNEventHandleris 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 implementISVNExternalsHandler. The user's implementationISVNExternalsHandler.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-nullexternal 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 returnsnullfor that external, it will be skipped (i.e. left as is, unprocessed). Note: this routine requires repository access.run()returnsSVNCommitInfocommit information information about the new committed revision.- Version:
- 1.7
- Author:
- TMate Software Ltd.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSvnRemoteCopy(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCopySource(SvnCopySource source)And one source to the operation's sources.ISvnCommitParametersgetCommitParameters()Returns operation's parameters of the commit.ISvnExternalsHandlergetExternalsHandler()Gets operation's externals handler.java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>>getExternalsToPin()protected java.io.FilegetOperationalWorkingCopy()java.util.Collection<SvnCopySource>getSources()Returns all operation's sources.booleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisDisableLocalModifications()Sets whether to disable local modifications.booleanisFailWhenDstExists()Gets whether to fail iftargetalready exists.booleanisMakeParents()Gets whether to make parent folders if don't exist.booleanisMove()Gets whether to do copy as move operation (delete, then add with history).booleanisPinExternals()SVNCommitInforun()Runs copy operation.voidsetCommitParameters(ISvnCommitParameters commitParameters)Sets operation's parameters of the commit.voidsetDisableLocalModifications(boolean disableLocalModifications)Sets whether to disable local modifications.voidsetExternalsHandler(ISvnExternalsHandler externalsHandler)Sets operation's externals handler.voidsetExternalsToPin(java.util.Map<SvnTarget,java.util.List<org.tmatesoft.svn.core.internal.wc.SVNExternal>> externalsToPin)voidsetFailWhenDstExists(boolean failWhenDstExists)Sets whether to fail iftargetalready exists.voidsetMakeParents(boolean makeParents)Sets whether to make parent folders if don't exist.voidsetMove(boolean move)Sets whether to do copy as move operation (delete, then add with history).voidsetPinExternals(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
-
-
-
-
Constructor Detail
-
SvnRemoteCopy
protected SvnRemoteCopy(SvnOperationFactory factory)
-
-
Method Detail
-
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 move)
Sets whether to do copy as move operation (delete, then add with history).- Parameters:
move-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 makeParents)
Sets whether to make parent folders if don't exist.- Parameters:
makeParents-trueif non-existent parent directories should be created, otherwisefalse
-
isDisableLocalModifications
public boolean isDisableLocalModifications()
Sets whether to disable local modifications.- Returns:
trueif local modifications are disabled, otherwisefalse- See Also:
setDisableLocalModifications(boolean)
-
setDisableLocalModifications
public void setDisableLocalModifications(boolean disableLocalModifications)
Sets whether to disable local modifications. Iftrueand any local modification is found,run()method throwsSVNExceptionexception withSVNErrorCode.ILLEGAL_TARGETcode.- Parameters:
disableLocalModifications-trueif local modifications are disabled, otherwisefalse
-
getSources
public java.util.Collection<SvnCopySource> getSources()
Returns all operation's sources.- Returns:
- sources of the operation
- See Also:
SvnRemoteCopy
-
addCopySource
public void addCopySource(SvnCopySource source)
And one source to the operation's sources.- Parameters:
source- source of the operation- See Also:
SvnRemoteCopy
-
isFailWhenDstExists
public boolean isFailWhenDstExists()
Gets whether to fail iftargetalready exists.- Returns:
trueif fail whentargetalready exists, otherwisefalse- See Also:
SvnRemoteCopy
-
setFailWhenDstExists
public void setFailWhenDstExists(boolean failWhenDstExists)
Sets whether to fail iftargetalready exists.- Parameters:
failWhenDstExists-trueif fail whentargetalready exists, otherwisefalse- See Also:
SvnRemoteCopy
-
run
public SVNCommitInfo run() throws SVNException
Runs copy operation.- Overrides:
runin classSvnOperation<SVNCommitInfo>- Returns:
SVNCommitInfocommit information information about the new committed revision.- Throws:
SVNException
-
getExternalsHandler
public ISvnExternalsHandler getExternalsHandler()
Gets operation's externals handler.- Returns:
- externals handler of the operation
- See Also:
SvnRemoteCopy
-
setExternalsHandler
public void setExternalsHandler(ISvnExternalsHandler externalsHandler)
Sets operation's externals handler.- Parameters:
externalsHandler- externals handler of the operation- See Also:
SvnRemoteCopy
-
getCommitParameters
public ISvnCommitParameters getCommitParameters()
Returns operation's parameters of the commit. If no user parameters were previously specified, once creates and returnsdefaultones.- Returns:
- commit parameters of the operation
- See Also:
ISvnCommitParameters
-
setCommitParameters
public void setCommitParameters(ISvnCommitParameters commitParameters)
Sets operation's parameters of the commit. When no parameters are setdefaultones are used.- Parameters:
commitParameters- commit parameters of the operation- See Also:
ISvnCommitParameters
-
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)
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopyin classSvnOperation<SVNCommitInfo>- Returns:
trueif the operation changes the working copy, otherwisefalse
-
getOperationalWorkingCopy
protected java.io.File getOperationalWorkingCopy()
- Overrides:
getOperationalWorkingCopyin classSvnOperation<SVNCommitInfo>
-
-