Package org.tmatesoft.svn.core.wc2
Class SvnCommit
- 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.SvnCommit
-
- All Implemented Interfaces:
ISvnObjectReceiver<SVNCommitInfo>,ISvnOperationOptionsProvider
public class SvnCommit extends AbstractSvnCommit
Represents commit operation. Commits files or directories into repository. Iftargetshas zero elements, then do nothing and return immediately without error. If the caller'sevent handleris notnullit will be called as the commit progresses with any of the following actions:SVNEventAction.COMMIT_MODIFIED,SVNEventAction.COMMIT_ADDED,SVNEventAction.COMMIT_DELETED,SVNEventAction.COMMIT_REPLACED. If the commit succeeds, the handler will be called withSVNEventAction.COMMIT_COMPLETEDevent action. IfdepthisSVNDepth.INFINITY, commits all changes to and below named targets. IfdepthisSVNDepth.EMPTY, commits only named targets (that is, only property changes on named directory targets, and property and content changes for named file targets). IfdepthisSVNDepth.FILES, behaves as above for named file targets, and for named directory targets, commits property changes on a named directory and all changes to files directly inside that directory. IfSVNDepth.IMMEDIATES, behaves as forSVNDepth.FILES, and for subdirectories of any named directorytargetcommits as though forSVNDepth.EMPTY. Unlocks paths in the repository, unlesskeepLocksistrue.changelistsused as a restrictive filter on items that are committed; that is, doesn't commit anything unless it's a member of one of those changelists. After the commit completes successfully, removes changelist associations from the targets, unlesskeepChangelistis set. Ifchangelistsis empty (or altogethernull), no changelist filtering occurs. If no exception is thrown andSVNCommitInfo.getNewRevision()is invalid (<0), then the commit was a no-op; nothing needed to be committed.run()returnsSVNCommitInfoinformation about new committed revision.run()throwsSVNExceptionin the following cases:-
exception with
SVNErrorCode.UNSUPPORTED_FEATUREerror code - if it is commit from different working copies belonging to different repositories exception withSVNErrorCode.CLIENT_PROPERTY_NAMEerror code - if there is standard Subversion property among revision properties exception withSVNErrorCode.WC_FOUND_CONFLICTerror code - if item is remaining in conflict exception withSVNErrorCode.ILLEGAL_TARGETerror code - if item is not under version control or item's parent is not known to exist in the repository and is not part of the commit, yet item is part of the commit exception withSVNErrorCode.WC_PATH_NOT_FOUNDerror code - if item is scheduled for addition within unversioned parent or item is scheduled for addition, but is missing exception withSVNErrorCode.NODE_UNKNOWN_KINDerror code - if item is of unknown kind exception withSVNErrorCode.NODE_UNEXPECTED_KINDerror code - item has unexpectedly changed special status exception withSVNErrorCode.WC_NOT_LOCKEDerror code - if working copy directory/file is missing exception withSVNErrorCode.CLIENT_DUPLICATE_COMMIT_URLerror code - if operation trying to commit different items referring to the same URL exception withSVNErrorCode.BAD_URLerror code - if working copy directory/file is missing exception withSVNErrorCode.WC_NOT_LOCKEDerror code - if operation cannot compute base URL for commit operation exception withSVNErrorCode.WC_CORRUPT_TEXT_BASEerror code - if working copy is corrupted- Version:
- 1.7
- Author:
- TMate Software Ltd.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSvnCommit(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SvnCommitPacketcollectCommitItems()Returns operation's commit packet.protected voidensureArgumentsAreValid()ISvnCommitParametersgetCommitParameters()Gets operation's parameters of the commit.protected intgetMaximumTargetsCount()protected voidinitDefaults()booleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisCombinePackets()booleanisFailOnMultipleRepositories()booleanisForce()Sets whether or not to force a non-recursive commit; ifdepthisSVNDepth.INFINITYtheforceflag is ignored.booleanisIncludeDirectoryExternals()booleanisIncludeFileExternals()booleanisKeepChangelists()Gets whether or notchangelistsshould be removed.booleanisKeepLocks()Gets whether or not to unlock files in the repository.SVNCommitInforun()If commit packet isnull, callscollectCommitItems()to create the commit packet, then executes the operation.voidsetCombinePackets(boolean combine)voidsetCommitParameters(ISvnCommitParameters commitParameters)Sets operation's parameters of the commit.voidsetFailOnMultipleRepositories(boolean fail)voidsetForce(boolean force)Gets whether or not to force a non-recursive commit; ifdepthisSVNDepth.INFINITYtheforceflag is ignored.voidsetIncludeDirectoryExternals(boolean includeDirectoryExternals)voidsetIncludeFileExternals(boolean includeFileExternals)voidsetKeepChangelists(boolean keepChangelists)Sets whether or notchangelistsshould be removed.voidsetKeepLocks(boolean keepLocks)Sets whether or not to unlock files in the repository.SvnCommitPacket[]splitCommitPackets(boolean combinePackets)-
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, last, receive, run, setReceiver
-
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation
addTarget, cancel, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMinimumTargetsCount, getOperationalWorkingCopy, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
-
-
-
-
Constructor Detail
-
SvnCommit
protected SvnCommit(SvnOperationFactory factory)
-
-
Method Detail
-
isKeepChangelists
public boolean isKeepChangelists()
Gets whether or notchangelistsshould be removed.- Returns:
trueifchangelistsshould be removed, otherwisefalse
-
setKeepChangelists
public void setKeepChangelists(boolean keepChangelists)
Sets whether or notchangelistsshould be removed.- Parameters:
keepChangelists-trueifchangelistsshould be removed, otherwisefalse
-
isKeepLocks
public boolean isKeepLocks()
Gets whether or not to unlock files in the repository.- Returns:
trueif files should not be unlocked in the repository, otherwisefalse
-
setKeepLocks
public void setKeepLocks(boolean keepLocks)
Sets whether or not to unlock files in the repository.- Parameters:
keepLocks-trueif files should not be unlocked in the repository, otherwisefalse
-
getCommitParameters
public ISvnCommitParameters getCommitParameters()
Gets operation's parameters of the commit.- Returns:
- commit parameters of the operation
- See Also:
ISvnCommitParameters
-
setCommitParameters
public void setCommitParameters(ISvnCommitParameters commitParameters)
Sets operation's parameters of the commit.- Parameters:
commitParameters- commit parameters of the operation- See Also:
ISvnCommitParameters
-
collectCommitItems
public SvnCommitPacket collectCommitItems() throws SVNException
Returns operation's commit packet. Checks arguments and callsSvnOperationFactory.collectCommitItems(SvnCommit)if commit packet isnull.- Returns:
- commit packet of the operation
- Throws:
SVNException
-
splitCommitPackets
public SvnCommitPacket[] splitCommitPackets(boolean combinePackets) throws SVNException
- Throws:
SVNException
-
run
public SVNCommitInfo run() throws SVNException
If commit packet isnull, callscollectCommitItems()to create the commit packet, then executes the operation.- Overrides:
runin classSvnOperation<SVNCommitInfo>- Returns:
- result depending on operation type
- Throws:
SVNException
-
ensureArgumentsAreValid
protected void ensureArgumentsAreValid() throws SVNException- Overrides:
ensureArgumentsAreValidin classSvnOperation<SVNCommitInfo>- Throws:
SVNException
-
getMaximumTargetsCount
protected int getMaximumTargetsCount()
- Overrides:
getMaximumTargetsCountin classSvnOperation<SVNCommitInfo>
-
setForce
public void setForce(boolean force)
Gets whether or not to force a non-recursive commit; ifdepthisSVNDepth.INFINITYtheforceflag is ignored.- Parameters:
force-trueif non-recursive commit should be forced, otherwisefalse
-
isForce
public boolean isForce()
Sets whether or not to force a non-recursive commit; ifdepthisSVNDepth.INFINITYtheforceflag is ignored.- Returns:
trueif non-recursive commit should be forced, otherwisefalse
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopyin classSvnOperation<SVNCommitInfo>- Returns:
trueif the operation changes the working copy, otherwisefalse
-
setCombinePackets
public void setCombinePackets(boolean combine)
-
isCombinePackets
public boolean isCombinePackets()
-
isFailOnMultipleRepositories
public boolean isFailOnMultipleRepositories()
-
setFailOnMultipleRepositories
public void setFailOnMultipleRepositories(boolean fail)
-
isIncludeFileExternals
public boolean isIncludeFileExternals()
-
setIncludeFileExternals
public void setIncludeFileExternals(boolean includeFileExternals)
-
isIncludeDirectoryExternals
public boolean isIncludeDirectoryExternals()
-
setIncludeDirectoryExternals
public void setIncludeDirectoryExternals(boolean includeDirectoryExternals)
-
initDefaults
protected void initDefaults()
- Overrides:
initDefaultsin classSvnReceivingOperation<SVNCommitInfo>
-
-