tracopt.versioncontrol.git.PyGIT

class tracopt.versioncontrol.git.PyGIT.Storage(git_dir, log, git_bin='git', git_fs_encoding=None, rev_cache=None)

Bases: object

High-level wrapper around GitCore with in-memory caching

Initialize PyGit.Storage instance

git_dir: path to .git folder;
this setting is not affected by the git_fs_encoding setting

log: logger instance

git_bin: path to executable
this setting is not affected by the git_fs_encoding setting
git_fs_encoding: encoding used for paths stored in git repository;
if None, no implicit decoding/encoding to/from unicode objects is performed, and bytestrings are returned instead
children_recursive(sha, rev_dict=None)

Recursively traverse children in breadth-first order

diff_tree(tree1, tree2, path='', find_renames=False)

calls git diff-tree and returns tuples of the kind (mode1,mode2,obj1,obj2,action,path1,path2)

fullrev(srev)

try to reverse shortrev()

get_branch_contains(sha, resolve=False)

return list of reachable head sha ids or (names, sha) pairs if resolve is true

see also get_branches()

get_branches()

returns list of (local) branches, with active (= HEAD) one being the first item

head()

get current HEAD commit id

rev_cache

Retrieve revision cache

may rebuild cache on the fly if required

returns RevCache tuple

rev_is_anchestor_of(rev1, rev2)

return True if rev2 is successor of rev1

shortrev(rev, min_len=7)

try to shorten sha id

verifyrev(rev)

verify/lookup given revision object and return a sha id or None if lookup failed

tracopt.versioncontrol.git.PyGIT.parse_commit(raw)

Parse the raw content of a commit (as given by git cat-file -p).

Return the commit message and a dict of properties.

class tracopt.versioncontrol.git.PyGIT.GitCore(git_dir=None, git_bin='git', log=None, fs_encoding=None)

Bases: object

Low-level wrapper around git executable

classmethod is_sha(sha)

returns whether sha is a potential sha id (i.e. proper hexstring between 4 and 40 characters)

class tracopt.versioncontrol.git.PyGIT.SizedDict(max_size=0)

Bases: dict

Size-bounded dictionary with FIFO replacement strategy