Merge "Resolve project_name/project confusion for gerrit" into feature/zuulv3
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index f266f2a..73979be 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -526,16 +526,16 @@
# Wait for the ref to show up in the repo
start = time.time()
while time.time() - start < self.replication_timeout:
- sha = self.getRefSha(project.name, ref)
+ sha = self.getRefSha(project, ref)
if old_sha != sha:
return True
time.sleep(self.replication_retry_interval)
return False
- def getRefSha(self, project_name, ref):
+ def getRefSha(self, project, ref):
refs = {}
try:
- refs = self.getInfoRefs(project_name)
+ refs = self.getInfoRefs(project)
except:
self.log.exception("Exception looking for ref %s" %
ref)
@@ -597,7 +597,7 @@
return changes
def getProjectBranches(self, project):
- refs = self.getInfoRefs(project.name)
+ refs = self.getInfoRefs(project)
heads = [str(k[len('refs/heads/'):]) for k in refs.keys()
if k.startswith('refs/heads/')]
return heads
@@ -731,9 +731,9 @@
raise Exception("Gerrit error executing %s" % command)
return (out, err)
- def getInfoRefs(self, project_name):
+ def getInfoRefs(self, project):
url = "%s/p/%s/info/refs?service=git-upload-pack" % (
- self.baseurl, project_name)
+ self.baseurl, project.name)
try:
data = urllib.request.urlopen(url).read()
except:
diff --git a/zuul/driver/gerrit/gerritreporter.py b/zuul/driver/gerrit/gerritreporter.py
index 0ade355..a855db3 100644
--- a/zuul/driver/gerrit/gerritreporter.py
+++ b/zuul/driver/gerrit/gerritreporter.py
@@ -33,7 +33,7 @@
(item.change, self.config, message))
changeid = '%s,%s' % (item.change.number, item.change.patchset)
item.change._ref_sha = source.getRefSha(
- item.change.project.name, 'refs/heads/' + item.change.branch)
+ item.change.project, 'refs/heads/' + item.change.branch)
return self.connection.review(item.change.project.name, changeid,
message, self.config)