org.tmatesoft.svn.core.wc
Class SVNMoveClient

java.lang.Object
  extended by org.tmatesoft.svn.core.wc.SVNBasicClient
      extended by org.tmatesoft.svn.core.wc.SVNMoveClient

public class SVNMoveClient
extends SVNBasicClient

The SVNMoveClient provides an extra client-side functionality over standard (i.e. compatible with the SVN command line client) move operations. This class helps to overcome the SVN limitations regarding move operations. Using SVNMoveClient you can easily:

Since:
1.2

Constructor Summary
SVNMoveClient(ISVNAuthenticationManager authManager, ISVNOptions options)
          Constructs and initializes an SVNMoveClient object with the specified run-time configuration and authentication drivers.
SVNMoveClient(ISVNRepositoryPool repositoryPool, ISVNOptions options)
          Constructs and initializes an SVNMoveClient object with the specified run-time configuration and repository pool object.
 
Method Summary
 void doMove(java.io.File src, java.io.File dst)
          Moves a source item to a destination one.
 void doVirtualCopy(java.io.File src, java.io.File dst, boolean move)
          Copies/moves administrative version control information of a source file to administrative information of a destination file.
 void undoMove(java.io.File src, java.io.File dst)
          Reverts a previous move operation back.
 
Methods inherited from class org.tmatesoft.svn.core.wc.SVNBasicClient
dontWC17Support, getDebugLog, getOperationsFactory, getOptions, getPathListHandler, getReposRoot, getReposRoot, isIgnoreExternals, isLeaveConflictsUnresolved, isWC17Supported, setDebugLog, setEventHandler, setEventPathPrefix, setIgnoreExternals, setLeaveConflictsUnresolved, setOptions, setPathListHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNMoveClient

public SVNMoveClient(ISVNAuthenticationManager authManager,
                     ISVNOptions options)
Constructs and initializes an SVNMoveClient object with the specified run-time configuration and authentication drivers.

If options is null, then this SVNMoveClient will be using a default run-time configuration driver which takes client-side settings from the default SVN's run-time configuration area but is not able to change those settings (read more on ISVNOptions and SVNWCUtil).

If authManager is null, then this SVNMoveClient will be using a default authentication and network layers driver (see SVNWCUtil.createDefaultAuthenticationManager()) which uses server-side settings and auth storage from the default SVN's run-time configuration area (or system properties if that area is not found).

Parameters:
authManager - an authentication and network layers driver
options - a run-time configuration options driver

SVNMoveClient

public SVNMoveClient(ISVNRepositoryPool repositoryPool,
                     ISVNOptions options)
Constructs and initializes an SVNMoveClient object with the specified run-time configuration and repository pool object.

If options is null, then this SVNMoveClient will be using a default run-time configuration driver which takes client-side settings from the default SVN's run-time configuration area but is not able to change those settings (read more on ISVNOptions and SVNWCUtil).

If repositoryPool is null, then SVNRepositoryFactory will be used to create repository access objects.

Parameters:
repositoryPool - a repository pool object
options - a run-time configuration options driver
Method Detail

doMove

public void doMove(java.io.File src,
                   java.io.File dst)
            throws SVNException
Moves a source item to a destination one.

dst should not exist. Furher it's considered to be versioned if its parent directory is under version control, otherwise dst is considered to be unversioned.

If both src and dst are unversioned, then simply moves src to dst in the filesystem.

If src is versioned but dst is not, then exports src to dst in the filesystem and removes src from version control.

If dst is versioned but src is not, then moves src to dst (even if dst is scheduled for deletion).

If both src and dst are versioned and located within the same Working Copy, then moves src to dst (even if dst is scheduled for deletion), or tries to replace dst with src if the former is missing and has a node kind different from the node kind of the source. If src is scheduled for addition with history, dst will be set the same ancestor URL and revision from which the source was copied. If src and dst are located in different Working Copies, then this method copies src to dst, tries to put the latter under version control and finally removes src.

Parameters:
src - a source path
dst - a destination path
Throws:
SVNException - if one of the following is true:
  • dst already exists
  • src does not exist

undoMove

public void undoMove(java.io.File src,
                     java.io.File dst)
              throws SVNException
Reverts a previous move operation back. Provided in pair with doMove() and used to roll back move operations. In this case src is considered to be the target of the previsous move operation, and dst is regarded to be the source of that same operation which have been moved to src and now is to be restored.

dst could exist in that case if it has been a WC directory that was scheduled for deletion during the previous move operation. Furher dst is considered to be versioned if its parent directory is under version control, otherwise dst is considered to be unversioned.

If both src and dst are unversioned, then simply moves src back to dst in the filesystem.

If src is versioned but dst is not, then unmoves src to dst in the filesystem and removes src from version control.

If dst is versioned but src is not, then first tries to make a revert on dst - if it has not been committed yet, it will be simply reverted. However in the case dst has been already removed from the repository, src will be copied back to dst and scheduled for addition. Then src is removed from the filesystem.

If both src and dst are versioned then the following situations are possible:

Parameters:
src - a source path
dst - a destination path
Throws:
SVNException - if src does not exist

doVirtualCopy

public void doVirtualCopy(java.io.File src,
                          java.io.File dst,
                          boolean move)
                   throws SVNException
Copies/moves administrative version control information of a source file to administrative information of a destination file. For example, if you have manually copied/moved a source file to a target 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 the target .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 target already exists and the source may be already deleted. Use this method to overcome that restriction.

Parameters:
src - a source file path (was copied/moved to dst)
dst - a destination file path
move - if true then completes moving src to dst, otherwise completes copying src to dst
Throws:
SVNException - if one of the following is true:
  • move = true and src still exists
  • dst does not exist
  • dst is a directory
  • src is a directory
  • src is not under version control
  • dst 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 for src