Package moap :: Package vcs :: Module vcs :: Class VCS
[hide private]
[frames] | no frames]

Class VCS

source code

extern.log.log.Loggable --+
                          |
                         VCS
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, path=None) source code
 
backup(self, archive)
Back up the given VCS checkout into an archive.
source code
bool
commit(self, paths, message)
Commit the given list of paths, with the given message.
source code
dict of str -> list of str
createTree(self, paths)
Given the list of paths, create a dict of parentPath -> [child, ...] If the path is in the root of the repository, parentPath will be ''
source code
str
diff(self, path)
Return a diff for the given path.
source code
 
diffCheckout(self, checkoutDir)
Diff our checkout to the given checkout directory.
source code
list of str
getAdded(self, path)
Get a list of paths newly added under the given path and relative to it.
source code
 
getChanges(self, path, diff=None)
Get a list of changes for the given path and subpaths.
source code
str
getCheckoutCommands(self)
Return shell commands necessary to do a fresh checkout of the current checkout into a directory called 'checkout'.
source code
list of str
getDeleted(self, path)
Get a list of deleted paths under the given path and relative to it.
source code
 
getFileMatcher(self)
Return an re matcher object that will expand to the file being changed.
source code
list of str
getIgnored(self, path)
Get a list of ignored paths under the given path and relative to it.
source code
dict of str -> list of str
getPropertyChanges(self, path)
Get a list of property changes for the given path and subpaths.
source code
list of str
getUnknown(self, path)
Get a list of unknown paths under the given path and relative to it.
source code
 
ignore(self, paths, commit=True)
Make the VCS ignore the given list of paths.
source code
 
restore(self, archive, path)
Restore from the given archive to the given path.
source code
 
update(self, path)
Update the given path to the latest version.
source code

Inherited from extern.log.log.Loggable: debug, doLog, error, info, log, logFunction, logObjectName, warning, warningFailure, writeMarker

Class Variables [hide private]
  logCategory = 'VCS'
Implementors can provide a category to log their messages under.
  name = 'Some Version Control System'
Instance Variables [hide private]
list of str meta = None
paths that contain VCS metadata
  path = None
the path to the top of the source tree
Method Details [hide private]

backup(self, archive)

source code 

Back up the given VCS checkout into an archive.

This stores all unignored files, as well as a checkout command and a diff, so the working directory can be fully restored.

The archive will contain:

  • a subdirectory called unignored
  • a file called diff
  • an executable file called checkout.sh
Raises:

commit(self, paths, message)

source code 

Commit the given list of paths, with the given message. Note that depending on the VCS, parents that were just added may need to be commited as well.

Parameters:
  • paths (list)
  • message (str)
Returns: bool

diff(self, path)

source code 

Return a diff for the given path.

The diff should not end in a newline; an empty diff should be an empty string.

The diff should also be relative to the working directory; no absolute paths.

Returns: str
the diff

diffCheckout(self, checkoutDir)

source code 

Diff our checkout to the given checkout directory.

Only complains about diffs in files we're interested in, which are tracked or unignored files.

getAdded(self, path)

source code 

Get a list of paths newly added under the given path and relative to it.

Parameters:
  • path (str) - the path under which to check for files
Returns: list of str
list of paths

getChanges(self, path, diff=None)

source code 

Get a list of changes for the given path and subpaths.

Parameters:
  • diff (str) - the diff to use instead of a local vcs diff (only useful for testing)
Returns:
dict of path -> list of (oldLine, oldCount, newLine, newCount)

getCheckoutCommands(self)

source code 

Return shell commands necessary to do a fresh checkout of the current checkout into a directory called 'checkout'.

Returns: str
newline-terminated string of commands.

getDeleted(self, path)

source code 

Get a list of deleted paths under the given path and relative to it.

Parameters:
  • path (str) - the path under which to check for files
Returns: list of str
list of paths

getFileMatcher(self)

source code 

Return an re matcher object that will expand to the file being changed.

The default implementation works for CVS and SVN.

getIgnored(self, path)

source code 

Get a list of ignored paths under the given path and relative to it.

Parameters:
  • path (str) - the path under which to check for files
Returns: list of str
list of paths

getPropertyChanges(self, path)

source code 

Get a list of property changes for the given path and subpaths. These are metadata changes to files, not content changes.

Returns: dict of str -> list of str
dict of path -> list of property names

getUnknown(self, path)

source code 

Get a list of unknown paths under the given path and relative to it.

Parameters:
  • path (str) - the path under which to check for files
Returns: list of str
list of paths

ignore(self, paths, commit=True)

source code 

Make the VCS ignore the given list of paths.

Parameters:
  • paths (list of str) - list of paths, relative to the checkout directory
  • commit (boolean) - if True, commit the ignore updates.