aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-02-19 19:07:32 +0100
committerGuido Günther <agx@sigxcpu.org>2009-02-19 19:09:23 +0100
commita498bdf1b4a20fef1dea1a0d051899372aa50b73 (patch)
treee1c0f1e110cffd4a9efaae6e1379826cb8abe02d
parent28973fb3a81569dda1ec3dcd9f6036b24bbbbdc1 (diff)
add GitRepository.rev_parse
-rw-r--r--gbp/git_utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index ce4ebed..193efeb 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')