summaryrefslogtreecommitdiff
path: root/zuul/source
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@redhat.com>2016-10-04 14:19:57 -0700
committerJames E. Blair <jeblair@redhat.com>2016-10-04 15:01:31 -0700
commit51b7492e95bce924efdbafbac996d746a6b9cb18 (patch)
tree794053209f134fc98ce01fd2a41c26d4a97966d6 /zuul/source
parent0eaad558b5d02625b75ba772aceafcb03c4ed2b5 (diff)
downloadzuul-51b7492e95bce924efdbafbac996d746a6b9cb18.tar.gz
Add getProjectBranches to Source
This lets us ask a source for all of the branches for a project. This uses the git protocol for now, but this can get much nicer in the future if we switch to using Gerrit's REST API. It should also be easy to do with github. The included comment indicates why it's being added -- implementation to follow in subsequent changes. Change-Id: I0dfcd61f343a235dcf935aea434b9772d6e746d9
Diffstat (limited to 'zuul/source')
-rw-r--r--zuul/source/__init__.py4
-rw-r--r--zuul/source/gerrit.py3
2 files changed, 7 insertions, 0 deletions
diff --git a/zuul/source/__init__.py b/zuul/source/__init__.py
index d92d47af9..69dc16255 100644
--- a/zuul/source/__init__.py
+++ b/zuul/source/__init__.py
@@ -63,3 +63,7 @@ class BaseSource(object):
@abc.abstractmethod
def getProject(self, name):
"""Get a project."""
+
+ @abc.abstractmethod
+ def getProjectBranches(self, project):
+ """Get branches for a project"""
diff --git a/zuul/source/gerrit.py b/zuul/source/gerrit.py
index 0d28898d3..8b85a4676 100644
--- a/zuul/source/gerrit.py
+++ b/zuul/source/gerrit.py
@@ -41,6 +41,9 @@ class GerritSource(BaseSource):
def getProjectOpenChanges(self, project):
return self.connection.getProjectOpenChanges(project)
+ def getProjectBranches(self, project):
+ return self.connection.getProjectBranches(project)
+
def getGitUrl(self, project):
return self.connection.getGitUrl(project)