Add branches arg to createProject

This new functiona argument will allow callers to set the default
project branch on repo creation. It takes a list, all branches will be
created with the first being repo HEAD.

Change-Id: Iae5a71662740678e663bcd73d6ac660559db5d9a
This commit is contained in:
Clark Boylan 2020-07-15 09:20:28 -07:00
parent 95e17ddf05
commit 6058d994b8
4 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,7 @@
- job:
name: gerritlib-jeepyb-integration
description: Run manage_projects with gerritlib from source against Gerrit
pre-run: playbooks/jeepyb-integration/pre.yaml
run: playbooks/jeepyb-integration/run.yaml
post-run: playbooks/jeepyb-integration/post.yaml
required-projects:

View File

@ -257,7 +257,7 @@ class Gerrit(object):
self._setMember('remove', group, member)
def createProject(self, project, require_change_id=True, empty_repo=False,
description=None):
description=None, branches=None):
cmd = 'gerrit create-project'
if require_change_id:
cmd = '%s --require-change-id' % cmd
@ -266,6 +266,10 @@ class Gerrit(object):
if description:
cmd = "%s --description \"%s\"" % \
(cmd, description.replace('"', r'\"'))
if branches:
# Branches should be a list. The first entry will be repo HEAD.
for branch in branches:
cmd = "%s --branch \"%s\"" % (cmd, branch)
version = None
try:
version = self.parseGerritVersion(self.getVersion())

View File

@ -0,0 +1,3 @@
- hosts: all
roles:
- name: ensure-pip

View File

@ -10,6 +10,7 @@
acl-config: tools/acls/test/test.config
groups:
- testing
default-branch: main
- project: test/test-repo-3
description: A retired repo
acl-config: tools/acls/test/retired.config