feat(repo-creation): added svn bootstrap, and improved repo creation validation

Also added refined UI, ability to pre-validate repo names

fold: repo create

fold repo creation

foldz

feat(repo-creation): added svn bootstrap, and improved repo creation validation

Also added refined UI, ability to pre-validate repo names

fold: repo create

fold repo creation

foldz

fold
This commit is contained in:
RhodeCode Admin 2025-12-23 21:04:15 +01:00
parent ee52770fff
commit cd01bbbddd
23 changed files with 656 additions and 200 deletions

View file

@ -777,6 +777,8 @@ def create_repo(
enable_locking=Optional(False),
enable_downloads=Optional(False),
copy_permissions=Optional(False),
bootstrap_readme=Optional(False),
bootstrap_svn_branch_struct=Optional(False),
):
"""
Creates a repository.
@ -816,10 +818,12 @@ def create_repo(
:type enable_downloads: bool
:param enable_statistics:
:type enable_statistics: bool
:param copy_permissions: Copy permission from group in which the
repository is being created.
:param copy_permissions: Copy permission from group in which the repository is being created.
:type copy_permissions: bool
:param bootstrap_readme: Add default readme for new repositories
:type bootstrap_readme: bool
:param bootstrap_svn_branch_struct: Add branches/tags structure for SVN repositories.
:type bootstrap_svn_branch_struct: bool
Example output:
@ -840,7 +844,7 @@ def create_repo(
id : <id_given_in_input>
result : null
error : {
error : {
'failed to create repository `<repo_name>`'
}
@ -865,6 +869,11 @@ def create_repo(
if isinstance(enable_downloads, Optional):
enable_downloads = defs.get("repo_enable_downloads")
if isinstance(bootstrap_readme, Optional):
bootstrap_readme = Optional.extract(bootstrap_readme)
if isinstance(bootstrap_svn_branch_struct, Optional):
bootstrap_svn_branch_struct = Optional.extract(bootstrap_svn_branch_struct)
landing_ref, _label = ScmModel.backend_landing_ref(repo_type)
ref_choices, _labels = ScmModel().get_repo_landing_revs(request.translate)
ref_choices = list(set(ref_choices + [landing_ref]))
@ -894,6 +903,8 @@ def create_repo(
repo_enable_statistics=enable_statistics,
repo_enable_downloads=enable_downloads,
repo_enable_locking=enable_locking,
repo_bootstrap_readme=bootstrap_readme,
repo_bootstrap_svn_branch_struct=bootstrap_svn_branch_struct,
)
)
except validation_schema.Invalid as err:
@ -915,6 +926,8 @@ def create_repo(
"enable_locking": schema_data["repo_enable_locking"],
"enable_downloads": schema_data["repo_enable_downloads"],
"repo_copy_permissions": schema_data["repo_copy_permissions"],
"repo_bootstrap_readme": schema_data["repo_bootstrap_readme"],
"repo_bootstrap_svn_branch_struct": schema_data["repo_bootstrap_svn_branch_struct"],
}
task = RepoModel().create(form_data=data, cur_user=owner.user_id)