aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2008-09-22 19:54:00 +0200
committerGuido Guenther <agx@sigxcpu.org>2008-09-22 20:07:08 +0200
commit519901ec9dccb0c47e1f067a8cc6dd2ab3e8f5b9 (patch)
tree0d4aa2908e3ee08983bbcb4c7405cdb628ceedaf
parent631c3479cc8ee98374ecd07de038aeac01c09695 (diff)
add find_tag(branch)
-rw-r--r--gbp/git_utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/gbp/git_utils.py b/gbp/git_utils.py
index 670d990..9885fc9 100644
--- a/gbp/git_utils.py
+++ b/gbp/git_utils.py
@@ -111,6 +111,13 @@ class GitRepository(object):
for line in commit:
yield line
+ def find_tag(self, branch):
+ "find the closest tag to a branch's head"
+ tag, ret = self.__git_getoutput('describe', [ "--abbrev=0", branch ])
+ if ret:
+ raise GitRepositoryError, "can't find tag for %s" % branch
+ return tag[0].strip()
+
def write_tree(self):
"""write out the current index, return the SHA1"""
tree, ret = self.__git_getoutput('write-tree')