summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-09-05 13:35:49 +0200
committerGuido Günther <agx@sigxcpu.org>2009-09-05 13:44:38 +0200
commit838b3f4493686c851298ba275156702aa07b1734 (patch)
tree675eba4a880ec6921b8d0096374bb182cf19fd3d
parent2663f2312c167bbbeb900aff3b8b07f9afbd4f69 (diff)
make has_branch aware of remote branches
-rw-r--r--gbp/git.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 014403e9..256f95e3 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -38,10 +38,17 @@ class GitRepository(object):
output += popen.stdout.readlines()
return output, ret
- def has_branch(self, branch):
- """check if the repository has branch 'branch'"""
+ def has_branch(self, branch, remote=False):
+ """
+ check if the repository has branch 'branch'
+ @param remote: only liste remote branches
+ """
self.__check_path()
- for line in self.__git_getoutput('branch', [ '--no-color' ])[0]:
+ options = [ '--no-color' ]
+ if remote:
+ options += [ '-r' ]
+
+ for line in self.__git_getoutput('branch', options)[0]:
if line.split(' ', 1)[1].strip() == branch:
return True
return False