aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-01-31 21:08:03 +0100
committerGuido Günther <agx@sigxcpu.org>2010-01-31 21:09:59 +0100
commitcbc05774e867d697dd80f5dbc1593f8b1c506376 (patch)
tree04784c570ab64e2a397a302380493f7add2e34de
parent24ac91c3d43ef99bd137cf570dd5ba353f8b9198 (diff)
Add GitRepository.get_remotes()
to easily query remote branches
-rw-r--r--gbp/git.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/gbp/git.py b/gbp/git.py
index 60914885..7743bdd1 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -221,6 +221,12 @@ class GitRepository(object):
name = os.getenv("GIT_AUTHOR_NAME", name)
return (name, email)
+ def get_remotes(self):
+ """Get all remote branches"""
+ args = [ '--format=%(refname:short)', 'refs/remotes/' ]
+ out = self.__git_getoutput('for-each-ref', args)[0]
+ return [ ref.strip() for ref in out ]
+
class FastImport(object):
"""Invoke git-fast-import"""