vcs-settings: when setting landing ref from UI switch default GIT branch too.
fixes #5663
This commit is contained in:
parent
4508de422b
commit
57eecdce7f
1 changed files with 9 additions and 0 deletions
|
|
@ -467,6 +467,9 @@ class RepoModel(BaseModel):
|
|||
RepoModel().grant_user_permission(
|
||||
repo=cur_repo, user=User.DEFAULT_USER, perm=EMPTY_PERM
|
||||
)
|
||||
if kwargs.get('repo_landing_rev'):
|
||||
landing_rev_val = kwargs['repo_landing_rev']
|
||||
RepoModel().set_landing_rev(cur_repo, landing_rev_val)
|
||||
|
||||
# handle extra fields
|
||||
for field in filter(lambda k: k.startswith(RepositoryField.PREFIX), kwargs):
|
||||
|
|
@ -933,6 +936,12 @@ class RepoModel(BaseModel):
|
|||
if field:
|
||||
self.sa.delete(field)
|
||||
|
||||
def set_landing_rev(self, repo, landing_rev_name):
|
||||
if landing_rev_name.startswith('branch:'):
|
||||
landing_rev_name = landing_rev_name.split('branch:')[-1]
|
||||
scm_instance = repo.scm_instance()
|
||||
return scm_instance._remote.set_head_ref(landing_rev_name)
|
||||
|
||||
def _create_filesystem_repo(self, repo_name, repo_type, repo_group,
|
||||
clone_uri=None, repo_store_location=None,
|
||||
use_global_config=False, install_hooks=True):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue