Merger: support for finding branches in remote

The new merger.hasBranch() method let us find out whether the remote
repository has the given branch. That is probably of no use for Zuul
merger itself but will let me reproduce the devstack-gate
git_has_branch() bash function.

Change-Id: Ibca58172a7b41b1c6b63cdd4449a647020bad0c9
This commit is contained in:
Antoine Musso 2014-05-05 18:19:36 +02:00
parent 965233a6c7
commit d3fe17fee9
1 changed files with 5 additions and 0 deletions

View File

@ -95,6 +95,11 @@ class Repo(object):
branch_head = repo.heads[branch]
return branch_head.commit
def hasBranch(self, branch):
repo = self.createRepoObject()
origin = repo.remotes.origin
return branch in origin.refs
def getCommitFromRef(self, refname):
repo = self.createRepoObject()
if not refname in repo.refs: