diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-02-19 19:07:32 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-02-19 19:09:23 +0100 |
commit | a498bdf1b4a20fef1dea1a0d051899372aa50b73 (patch) | |
tree | e1c0f1e110cffd4a9efaae6e1379826cb8abe02d /gbp | |
parent | 28973fb3a81569dda1ec3dcd9f6036b24bbbbdc1 (diff) |
add GitRepository.rev_parse
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/git_utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py index ce4ebed9..193efeb7 100644 --- a/gbp/git_utils.py +++ b/gbp/git_utils.py @@ -58,7 +58,6 @@ class GitRepository(object): out, ret = self.__git_getoutput('tag', [ '-l', tag ]) return [ False, True ][len(out)] - def get_branch(self): """on what branch is the current working copy""" self.__check_path() @@ -132,6 +131,13 @@ class GitRepository(object): raise GitRepositoryError, "can't find tag for %s" % branch return tag[0].strip() + def rev_parse(self, name): + "find the SHA1" + sha, ret = self.__git_getoutput('rev-parse', [ "--verify", name]) + if ret: + raise GitRepositoryError, "can't find SHA1 for %s" % name + return sha[0].strip() + def write_tree(self): """write out the current index, return the SHA1""" tree, ret = self.__git_getoutput('write-tree') |