Package pology :: Module vcs :: Class VcsSubversion

Class VcsSubversion

object --+    
         |    
   VcsBase --+
             |
            VcsSubversion

VCS: Subversion.

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
bool or (bool, [string*])
add(self, paths, repadd=False)
Add paths to version control.
bool
remove(self, path)
Remove path from version control and from disk.
bool
move(self, spath, dpath)
Move versioned file or directory within the repository.
string
revision(self, path)
Get current revision ID of the path.
bool
is_clear(self, path)
Check if the path is in clear state.
bool
is_versioned(self, path)
Check if path is under version control.
bool
export(self, path, rev, dstpath, rewrite=None)
Export a versioned file or directory.
bool
commit(self, paths, message=None, msgfile=None, incparents=True)
Commit paths to the repository.
[(string*4)*]
log(self, path, rev1=None, rev2=None)
Get revision log of the path.
[string*]
to_commit(self, path)
Get paths which need to be committed within the given path.
[(string, string or (int, int, int, int))*]
diff(self, path, rev1=None, rev2=None)
Get diff between revisions of the given path.
bool
revert(self, path)
Revert a versioned file or directory.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

add(self, paths, repadd=False)

 

Add paths to version control.

It depends on the particular VCS what adding means, but in general it should be the point where the subsequent commit() on the same path will record addition in the repository history.

Also a single path can be given instead of sequence of paths.

Actually added paths may be different from input paths, e.g. if an input path is already version controlled, or input path's parent directory was added as well. List of added paths can be requested with repadd parameter, and it will become the second element of return value.

Parameters:
  • paths - paths to add
  • repadd - whether to report which paths were actually added
Returns: bool or (bool, [string*])
True if addition successful, possibly list of added paths
Overrides: VcsBase.add
(inherited documentation)

remove(self, path)

 

Remove path from version control and from disk.

It depends on the particular VCS what removing means, but in general it should be the point where the subsequent commit() on the same path will record removal in the repository history.

Parameters:
  • path - path to remove
Returns: bool
True if removal successful
Overrides: VcsBase.remove
(inherited documentation)

move(self, spath, dpath)

 

Move versioned file or directory within the repository.

It depends on the particular VCS what moving means, but in general it should be the point where the subsequent commit() on source and destination path (or their common parent directory) will record the move in the repository history.

Parameters:
  • spath - source path
  • dpath - destination path
Returns: bool
True if moving successful
Overrides: VcsBase.move
(inherited documentation)

revision(self, path)

 

Get current revision ID of the path.

Parameters:
  • path - path to query for revision
Returns: string
revision ID
Overrides: VcsBase.revision
(inherited documentation)

is_clear(self, path)

 

Check if the path is in clear state.

Clear state means none of: not version-controlled, modified, added...

Parameters:
  • path - path to check the state of
Returns: bool
True if clear
Overrides: VcsBase.is_clear
(inherited documentation)

is_versioned(self, path)

 

Check if path is under version control.

Parameters:
  • path - path to check
Returns: bool
True if versioned
Overrides: VcsBase.is_versioned
(inherited documentation)

export(self, path, rev, dstpath, rewrite=None)

 

Export a versioned file or directory.

Makes a copy of versioned file or directory pointed to by local path path, in the revision rev, to destination dstpath. If rev is None, the clean version of path according to current local repository state is copied to dstpath.

Final repository path, as determined from path, can be filtered through an external function rewrite before being used. The function takes as arguments the path and revision strings. This can be useful, for example, to reroute remote repository URL.

Parameters:
  • path - path of the versioned file or directory in local repository
  • rev - revision to export
  • dstpath - file path to export to
  • rewrite - function to filter resolved repository path
Returns: bool
True if fetching succeeded, False otherwise
Overrides: VcsBase.export
(inherited documentation)

commit(self, paths, message=None, msgfile=None, incparents=True)

 

Commit paths to the repository.

Paths can include any number of files and directories. Also a single path string can be given instead of a sequence. It depends on the particular VCS what committing means, but in general it should be the earliest level at which modifications are recorded in the repository history.

Commit message can be given either directly, through message parameter, or read from a file with path given by msgfile. If both message and msgfile are given, message takes precedence and msgfile is ignored. If the commit message is not given, VCS should ask for one as usual (pop an editor window, or whatever the user has configured).

Some VCS require that the parent directory of a path to be committed has been committed itself or included in the commit list if not. If that is the case, incparents parameter determines if this function should assure that non-committed parents are included into the commit list too. This may be expensive to check, so it is good to disable it if all parents are known to be committed or included in the input paths.

Parameters:
  • paths - paths to commit
  • message - commit message
  • msgfile - path to file with the commit message
  • incparents - whether to automatically include non-committed parents in the commit list
Returns: bool
True if committing succeeded, False otherwise
Overrides: VcsBase.commit
(inherited documentation)

log(self, path, rev1=None, rev2=None)

 

Get revision log of the path.

Revision log entry consists of revision ID, commiter name, date string, and commit message. Except the revision ID, any of these may be empty strings, depending on the particular VCS. The log is ordered from earliest to newest revision.

A section of entries between revisions rev1 (inclusive) and rev2 (exclusive) can be returned instead of the whole log. If rev1 is None, selected IDs start from the first in the log. If rev2 is None, selected IDs end with the last in the log.

If either rev1 or rev2 is not None and does not exist in the path's log, or the path is not versioned, empty log is returned.

Parameters:
  • path - path to query for revisions
  • rev1 - entries starting from this revision (inclusive)
  • rev2 - entries up to this revision (exclusive)
Returns: [(string*4)*]
revision ID, committer name, date string, commit message
Overrides: VcsBase.log
(inherited documentation)

to_commit(self, path)

 

Get paths which need to be committed within the given path.

Input path can be either a file or directory. If it is a directory, it depends on VCS whether it will only report files within it that need to be committed, or subdirectories too (including the given directory).

Parameters:
  • path - path to query for non-committed paths
Returns: [string*]
non-committed paths
Overrides: VcsBase.to_commit
(inherited documentation)

diff(self, path, rev1=None, rev2=None)

 

Get diff between revisions of the given path.

Unified diff is computed and reported as list of 2-tuples, where the first element is a tag, and the second the payload. For tags " ", "+", and "-", the payload is the line (without newline) which was equal, added or removed, respectively. Payload for tag ":" is the path of the diffed file, and for "@" the 4-tuple of old start line, old number of lines, new start line, and new number of lines, which are represented by the following difference segment.

Diffs can be requested between specific revisions. If both rev1 and rev2 are None, diff is taken from last known commit to working copy. If only rev2 is None diff is taken from rev1 to working copy.

Parameters:
  • path - path to query for modified lines
  • rev1 - diff from this revision
  • rev2 - diff to this revision
Returns: [(string, string or (int, int, int, int))*]
tagged unified diff
Overrides: VcsBase.diff
(inherited documentation)

revert(self, path)

 

Revert a versioned file or directory.

The path is reverted to the clean version of itself according to current local repository state.

Parameters:
  • path - path of the versioned file or directory in local repository
Returns: bool
True if reverting succeeded, False otherwise
Overrides: VcsBase.revert
(inherited documentation)