gate.versioning.cmdline
Class SvnRepository

java.lang.Object
  extended by gate.versioning.cmdline.AbstractRepository
      extended by gate.versioning.cmdline.SvnRepository
All Implemented Interfaces:
Repository

public class SvnRepository
extends AbstractRepository

SVN repository implementation. The public API of this class is documented on the Repository interface.

See Also:
Repository

Field Summary
 
Fields inherited from class gate.versioning.cmdline.AbstractRepository
commandOutput, nl, root, stderrOutput, stdoutOutput, workingDir
 
Constructor Summary
SvnRepository()
           
 
Method Summary
 boolean add(String fileName)
          Add to the repository.
 boolean checkin(String fileName, String message)
          Commit changes.
 boolean create(String dirName)
          Create a new repository filetree (i.e. not a new object but a new database/filesystem on disk).
 boolean delete(String fileName)
          Delete from the repository.
 String diff(String fileName)
          Get the difference with the repository version.
 boolean exists(String moduleName)
          Check for the existence of a module (i.e. top-level directory).
 String getCommandName()
          Returns "svn".
protected  List getPostCommand(String fileName, boolean noRoot)
          Get the post-subcommand elements of the command (e.g. root).
protected  List getPreCommand()
          Get the pre-subcommand elements of the command (e.g.
 boolean importDir(String dirName)
          Import a directory.
 boolean isModified(String fileName)
          Use the repository's status command to figure out if the file has been locally modified.
 boolean isOutOfDate(String fileName)
          Use the repository's status command to figure out if the file is out-of-date.
 boolean isUnknown(String fileName)
          Use the repository's status command to figure out if the file is unknown.
 void setRoot(String root)
          The root / URL of the repository.
 String status(String fileName)
          Status.
 boolean update(String fileName)
          Update.
 
Methods inherited from class gate.versioning.cmdline.AbstractRepository
buildCommandArray, buildCommandArray, checkin, checkout, getCommandOutput, getCommandStderr, getCommandStdout, getRepository, getRoot, init, runCommand, runCommand, setWorkingDir
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SvnRepository

public SvnRepository()
Method Detail

getCommandName

public String getCommandName()
Returns "svn".

Specified by:
getCommandName in interface Repository
Specified by:
getCommandName in class AbstractRepository

getPreCommand

protected List getPreCommand()
Get the pre-subcommand elements of the command (e.g. -d root).

Specified by:
getPreCommand in class AbstractRepository

getPostCommand

protected List getPostCommand(String fileName,
                              boolean noRoot)
Get the post-subcommand elements of the command (e.g. root).

Specified by:
getPostCommand in class AbstractRepository

setRoot

public void setRoot(String root)
The root / URL of the repository. SVN doesn't like backslash here (at least on version 1.2.3 Windoze build run from cygwin or via Runtime.exec), so substitute them all for slash.

Specified by:
setRoot in interface Repository
Overrides:
setRoot in class AbstractRepository

checkin

public boolean checkin(String fileName,
                       String message)
Commit changes.

Specified by:
checkin in interface Repository
Overrides:
checkin in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
message - a commit message.
Returns:
boolean representing success or failure.

update

public boolean update(String fileName)
Update.

Specified by:
update in interface Repository
Overrides:
update in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean representing success or failure.

status

public String status(String fileName)
Status.

Specified by:
status in interface Repository
Overrides:
status in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
String giving status ouput.

delete

public boolean delete(String fileName)
Delete from the repository.

Specified by:
delete in interface Repository
Overrides:
delete in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean representing success or failure.

add

public boolean add(String fileName)
Add to the repository.

Specified by:
add in interface Repository
Overrides:
add in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean representing success or failure.

diff

public String diff(String fileName)
Get the difference with the repository version.

Specified by:
diff in interface Repository
Overrides:
diff in class AbstractRepository
Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
a string containing the difference, or "" for no difference, or null for error.

create

public boolean create(String dirName)
Create a new repository filetree (i.e. not a new object but a new database/filesystem on disk). This method can be called before AbstractRepository.init() (so that we can create repositories without having an existing one).

Parameters:
dirName - the directory to work on, which will be created (should be an absolute path).
Returns:
boolean representing success or failure.

importDir

public boolean importDir(String dirName)
                  throws gate.util.GateException
Import a directory.

Parameters:
dirName - the directory to import (this must exist).
Returns:
boolean representing success or failure.
Throws:
gate.util.GateException - when the directory doesn't exist.

isModified

public boolean isModified(String fileName)
Use the repository's status command to figure out if the file has been locally modified.

Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean giving status indication.

isOutOfDate

public boolean isOutOfDate(String fileName)
Use the repository's status command to figure out if the file is out-of-date.

Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean giving status indication.

isUnknown

public boolean isUnknown(String fileName)
Use the repository's status command to figure out if the file is unknown.

Parameters:
fileName - the file or directory to work on (should be relative to the repository's working directory, and use "/" as a path separator).
Returns:
boolean giving status indication.

exists

public boolean exists(String moduleName)
Check for the existence of a module (i.e. top-level directory).

Parameters:
moduleName - directory to look for.
Returns:
boolean giving status indication.