vcstools module

This module provides functions which help to document the state of a version control system at the time, the VHIST file has been created. If you store your sourcecode in a repository created with one of the version control systems git or svn, you can use these routines to document which version of the source code was used during your program’s run.

Each routine in this module will document the revision number or id, the status of the working copy as well as uncommitted changes.

from pyvhist.vhistsection import VhistSection
from pyvhist.tempdir import TempDir
from pyvhist.vcstools import saveGitInfo

section = VhistSection()
temp = TempDir()
saveGitInfo("/path/to/my/sourcecode/", section, temp)
pyvhist.vcstools.saveGitInfo(gitWorkingCopyDir, vhistSection, tempDir, gitExecutable=None, findWorkingCopyRoot=False, revisionAttribute='gitRevision', workingCopyAttribute='gitWorkingCopy', diffFilename='git-diff.txt', diffReturnAttribute='gitDiffReturnValue', statusFilename='git-status.txt', statusReturnAttribute='gitStatusReturnValue')

Retrieves information about the git working copy and documents this information within vhistSection. The git revision is stored as a user-defined attribute. Both, the outputs of git status and git diff are stored as embedded files.

gitWorkingCopyDir is the directory, which contains the git working copy. This directory can either be the root of the git working copy or a subdirectory of the working copy. If it is a sub directory, VHIST will only document the sub directory unless findWorkingCopyRoot is set to True.

vhistSection must be a pyvhist.vhistsection.VhistSection object. The git information will be stored in this section.

tempDir must be a :class`pyvhist.tempdir.TempDir` object. The temporary files, which contain the output of git diff and git status are saved in this directory.

gitExecutable is an optional string containing the filepath or name of the git executable. If not specified, pyvhist will try to automatically detect it.

revisionAttribute, diffReturnAttribute and statusReturnAttribute store the names of generated user-defined attributes.

diffFilename and statusFilename are the basenames (without a path) of files, which store the output of git status and git diff.

If one of the git calls fails or the function can not find the git executable, the function will throw an exception of the type RuntimeError.

pyvhist.vcstools.saveSvnInfo(svnWorkingCopyDir, vhistSection, tempDir, svnExecutable=None, revisionAttribute='svnRevision', workingCopyAttribute='gitWorkingCopy', diffFilename='svn-diff.txt', diffReturnAttribute='svnDiffReturnValue', statusFilename='svn-status.txt', statusReturnAttribute='svnStatusReturnValue')

Retrieves information about the svn working copy and documents this information within vhistSection. The svn revision is stored as a user-defined attribute. Both, the outputs of svn status and git svn are stored as embedded files.

svnWorkingCopyDir is the directory, which contains the svn working copy. This directory can either be the root of the svn working copy or a subdirectory of the working copy. If it is a sub directory, VHIST will only document the sub directory unless findWorkingCopyRoot is set to True.

vhistSection must be a pyvhist.vhistsection.VhistSection object. The svn information will be stored in this section.

tempDir must be a :class`pyvhist.tempdir.TempDir` object. The temporary files, which contain the output of svn diff and svn status are saved in this directory.

svnExecutable is an optional string containing the filepath or name of the svn executable. If not specified, pyvhist will try to automatically detect it.

revisionAttribute, diffReturnAttribute and statusReturnAttribute store the names of generated user-defined attributes.

diffFilename and statusFilename are the basenames (without a path) of files, which store the output of git status and git diff.

If one of the svn calls fails, the function will throw an exception of the type RuntimeError.

Previous topic

zipsource module

Next topic

pythoninfo module

This Page