diff options
Diffstat (limited to 'gbp')
-rw-r--r-- | gbp/git_utils.py | 7 |
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') |