Fix gerrit branch creation detection
We detect when a new branch is created so that we know to perform
a reconfiguration which will include the new branch. However,
the detection for this case in the Gerrit driver still had the
pre-2.13 form of branch representation. Update it to support both
forms, and update the tests to use the new form.
Change-Id: I0480482a59a9f289ca4e449ce70fd1c0872e7999
diff --git a/tests/base.py b/tests/base.py
index 2a2f164..4de9134 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -499,7 +499,7 @@
"refUpdate": {
"oldRev": oldrev,
"newRev": repo.heads[branch].commit.hexsha,
- "refName": branch,
+ "refName": 'refs/heads/' + branch,
"project": project,
}
}
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index 59051bb..f4b090d 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -125,7 +125,9 @@
# This checks whether the event created or deleted a branch so
# that Zuul may know to perform a reconfiguration on the
# project.
- if event.type == 'ref-updated' and not event.ref.startswith('refs/'):
+ if (event.type == 'ref-updated' and
+ ((not event.ref.startswith('refs/')) or
+ event.ref.startswith('refs/heads'))):
if event.oldrev == '0' * 40:
event.branch_created = True
event.branch = event.ref