Merge "Allow setting Gitea repo branch on project creation"
This commit is contained in:
commit
b6f5d4f314
@ -120,14 +120,23 @@ class Gitea(object):
|
|||||||
|
|
||||||
def make_gitea_project(self, project, csrf_token):
|
def make_gitea_project(self, project, csrf_token):
|
||||||
org, repo = project['project'].split('/', 1)
|
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(
|
resp = self.post(
|
||||||
'/api/v1/org/{org}/repos'.format(org=org),
|
'/api/v1/org/{org}/repos'.format(org=org),
|
||||||
json=dict(
|
json=repo_properties)
|
||||||
auto_init=True,
|
|
||||||
description=project.get('description', '')[:255],
|
|
||||||
name=repo,
|
|
||||||
private=False,
|
|
||||||
readme='Default'))
|
|
||||||
self.log("Created repo:", project['project'])
|
self.log("Created repo:", project['project'])
|
||||||
|
|
||||||
def update_gitea_project_settings(self, project, csrf_token):
|
def update_gitea_project_settings(self, project, csrf_token):
|
||||||
|
Loading…
Reference in New Issue
Block a user