From 838b3f4493686c851298ba275156702aa07b1734 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sat, 5 Sep 2009 13:35:49 +0200 Subject: make has_branch aware of remote branches --- gbp/git.py | 13 ++++++++++--- 1 file 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 -- cgit v1.2.3