Pass source to project instantiations

So that we can store the canonical hostname.  Also use this to
find and store the connection name to keep the initializer signature
small.

Story: 2000953
Change-Id: Ie10f86ff3412016b411bcc511b4d9ad3af163d61
This commit is contained in:
James E. Blair
2017-03-29 13:22:16 -07:00
parent f4a5f02aa8
commit 0a89975543
7 changed files with 45 additions and 27 deletions

View File

@@ -14,6 +14,7 @@
import logging
from zuul.source import BaseSource
from zuul.model import Project
class GitSource(BaseSource):
@@ -38,7 +39,11 @@ class GitSource(BaseSource):
raise NotImplemented()
def getProject(self, name):
return self.connection.getProject(name)
p = self.connection.getProject(name)
if not p:
p = Project(name, self)
self.connection.addProject(p)
return p
def getProjectBranches(self, project):
return self.connection.getProjectBranches(project)