Merge "Allow setting Gitea repo branch on project creation"

This commit is contained in:
Zuul 2020-07-17 20:50:59 +00:00 committed by Gerrit Code Review
commit b6f5d4f314

View File

@ -120,14 +120,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):