diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-09-05 13:35:49 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-09-05 13:44:38 +0200 |
commit | 838b3f4493686c851298ba275156702aa07b1734 (patch) | |
tree | 675eba4a880ec6921b8d0096374bb182cf19fd3d | |
parent | 2663f2312c167bbbeb900aff3b8b07f9afbd4f69 (diff) |
make has_branch aware of remote branches
-rw-r--r-- | gbp/git.py | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -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 |