Class SvnCommit

All Implemented Interfaces:
ISvnObjectReceiver<SVNCommitInfo>, ISvnOperationOptionsProvider

public class SvnCommit extends AbstractSvnCommit
Represents commit operation. Commits files or directories into repository.

If targets has zero elements, then do nothing and return immediately without error.

If the caller's event handler is not null it 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 with SVNEventAction.COMMIT_COMPLETED event action.

If depth is SVNDepth.INFINITY, commits all changes to and below named targets. If depth is SVNDepth.EMPTY, commits only named targets (that is, only property changes on named directory targets, and property and content changes for named file targets). If depth is SVNDepth.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. If SVNDepth.IMMEDIATES, behaves as for SVNDepth.FILES, and for subdirectories of any named directory target commits as though for SVNDepth.EMPTY.

Unlocks paths in the repository, unless keepLocks is true.

changelists used 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, unless keepChangelist is set. If changelists is empty (or altogether null), no changelist filtering occurs.

If no exception is thrown and SVNCommitInfo.getNewRevision() is invalid (<0), then the commit was a no-op; nothing needed to be committed. run() returns SVNCommitInfo information about new committed revision. run() throws SVNException in the following cases:

Version:
1.7
Author:
TMate Software Ltd.
  • Constructor Details

  • Method Details

    • isKeepChangelists

      public boolean isKeepChangelists()
      Gets whether or not changelists should be removed.
      Returns:
      true if changelists should be removed, otherwise false
    • setKeepChangelists

      public void setKeepChangelists(boolean keepChangelists)
      Sets whether or not changelists should be removed.
      Parameters:
      keepChangelists - true if changelists should be removed, otherwise false
    • isKeepLocks

      public boolean isKeepLocks()
      Gets whether or not to unlock files in the repository.
      Returns:
      true if files should not be unlocked in the repository, otherwise false
    • setKeepLocks

      public void setKeepLocks(boolean keepLocks)
      Sets whether or not to unlock files in the repository.
      Parameters:
      keepLocks - true if files should not be unlocked in the repository, otherwise false
    • getCommitParameters

      public ISvnCommitParameters getCommitParameters()
      Gets operation's parameters of the commit.
      Returns:
      commit parameters of the operation
      See Also:
    • setCommitParameters

      public void setCommitParameters(ISvnCommitParameters commitParameters)
      Sets operation's parameters of the commit.
      Parameters:
      commitParameters - commit parameters of the operation
      See Also:
    • collectCommitItems

      public SvnCommitPacket collectCommitItems() throws SVNException
      Returns operation's commit packet. Checks arguments and calls SvnOperationFactory.collectCommitItems(SvnCommit) if commit packet is null.
      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 is null, calls collectCommitItems() to create the commit packet, then executes the operation.
      Overrides:
      run in class SvnOperation<SVNCommitInfo>
      Returns:
      result depending on operation type
      Throws:
      SVNException
    • ensureArgumentsAreValid

      protected void ensureArgumentsAreValid() throws SVNException
      Overrides:
      ensureArgumentsAreValid in class SvnOperation<SVNCommitInfo>
      Throws:
      SVNException
    • getMaximumTargetsCount

      protected int getMaximumTargetsCount()
      Overrides:
      getMaximumTargetsCount in class SvnOperation<SVNCommitInfo>
    • setForce

      public void setForce(boolean force)
      Gets whether or not to force a non-recursive commit; if depth is SVNDepth.INFINITY the force flag is ignored.
      Parameters:
      force - true if non-recursive commit should be forced, otherwise false
    • isForce

      public boolean isForce()
      Sets whether or not to force a non-recursive commit; if depth is SVNDepth.INFINITY the force flag is ignored.
      Returns:
      true if non-recursive commit should be forced, otherwise false
    • isChangesWorkingCopy

      public boolean isChangesWorkingCopy()
      Gets whether the operation changes working copy
      Overrides:
      isChangesWorkingCopy in class SvnOperation<SVNCommitInfo>
      Returns:
      true if the operation changes the working copy, otherwise false
    • 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:
      initDefaults in class SvnReceivingOperation<SVNCommitInfo>