From 6f03267aedaf7bf159af4016bdf46f21bc67cdd8 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 24 Oct 2009 19:16:04 +0200 Subject: add GitRepository.get_merge_branch() --- gbp/git.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gbp/git.py') diff --git a/gbp/git.py b/gbp/git.py index 256f95e..fea10f9 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() -- cgit v1.2.3