summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-10-24 19:16:04 +0200
committerGuido Günther <agx@sigxcpu.org>2009-10-24 19:56:44 +0200
commit6f03267aedaf7bf159af4016bdf46f21bc67cdd8 (patch)
tree36cd6fca0b67dce3eae07e6558c4c643a2ddd614
parentdb7cbab003b8edbfb973ef16d8aa291e7714c173 (diff)
downloadgit-buildpackage-6f03267aedaf7bf159af4016bdf46f21bc67cdd8.tar.gz
git-buildpackage-6f03267aedaf7bf159af4016bdf46f21bc67cdd8.tar.bz2
git-buildpackage-6f03267aedaf7bf159af4016bdf46f21bc67cdd8.zip
add GitRepository.get_merge_branch()
-rw-r--r--gbp/git.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 256f95e3..fea10f99 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -72,6 +72,17 @@ class GitRepository(object):
if line.startswith('*'):
return line.split(' ', 1)[1].strip()
+ def get_merge_branch(self, branch):
+ """get the branch we'd merge from"""
+ self.__check_path()
+ try:
+ remote = self.get_config("branch.%s.remote" % branch)
+ merge = self.get_config("branch.%s.merge" % branch)
+ except KeyError:
+ return None
+ remote += merge.replace("refs/heads","", 1)
+ return remote
+
def set_branch(self, branch):
"""switch to branch 'branch'"""
self.__check_path()