Allow setting Gitea repo branch on project creation

Note this shouldn't be used until we can configure Gerrit to do similar
with jeepyb. Otherwise we'll end up with mismatched branches between our
canonical source (Gerrit) and our mirrors (Gitea).

Change-Id: I8d353cbc90c2d354e7cdebfc4e247f3f73d97d86
This commit is contained in:
Clark Boylan 2020-07-15 08:59:18 -07:00
parent 8e0420ddf3
commit 1e2a34704a

View File

@ -122,14 +122,23 @@ class Gitea(object):
def make_gitea_project(self, project, csrf_token):
org, repo = project['project'].split('/', 1)
repo_properties = {
'auto_init': True,
'name': repo,
'description': project.get('description', '')[:255],
# Do not use this functionality until jeepyb can do similar
# for the gerrit side. Once Gerrit and Gitea can be configured
# this could be used on new repos.
# Note we default to master to avoid relying on tool defaults
# as we currently rely on Gitea, Gerrit, and Git to all be in
# sync which may not be the case going forward.
'default_branch': project.get('default-branch', 'master'),
'private': False,
'readme': 'Default',
}
resp = self.post(
'/api/v1/org/{org}/repos'.format(org=org),
json=dict(
auto_init=True,
description=project.get('description', '')[:255],
name=repo,
private=False,
readme='Default'))
json=repo_properties)
self.log("Created repo:", project['project'])
def update_gitea_project_settings(self, project, csrf_token):