Merge pull request !2787 from rhodecode-enterprise-ce feature/setting-to-pre-populate-branch-in-pr
Changes from branch: Feature/setting to pre populate branch in pr
This commit is contained in:
commit
2e4a6ec5d7
9 changed files with 101 additions and 8 deletions
|
|
@ -907,6 +907,7 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
branch=branch_ref,
|
||||
bookmark=bookmark_ref,
|
||||
translator=self.request.translate,
|
||||
prepopulate_branch=True, # Always pre-populate for source repo
|
||||
)
|
||||
except CommitDoesNotExistError as e:
|
||||
log.exception(e)
|
||||
|
|
@ -921,7 +922,14 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
# change default if we have a parent repo
|
||||
default_target_repo = source_repo.parent
|
||||
|
||||
target_repo_data = PullRequestModel().generate_repo_data(default_target_repo, translator=self.request.translate)
|
||||
# Get the target branch pre-population setting
|
||||
prepopulate_target_branch = self._get_repo_setting(
|
||||
default_target_repo, "rhodecode_pr_target_branch_prepopulate", True
|
||||
)
|
||||
|
||||
target_repo_data = PullRequestModel().generate_repo_data(
|
||||
default_target_repo, translator=self.request.translate, prepopulate_branch=prepopulate_target_branch
|
||||
)
|
||||
|
||||
selected_source_ref = source_repo_data["refs"]["selected_ref"]
|
||||
title_source_ref = ""
|
||||
|
|
@ -936,6 +944,7 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
"source_refs_json": ext_json.str_json(source_repo_data),
|
||||
"target_repo_name": default_target_repo.repo_name,
|
||||
"target_refs_json": ext_json.str_json(target_repo_data),
|
||||
"pr_target_branch_prepopulate": prepopulate_target_branch,
|
||||
}
|
||||
c.default_source_ref = selected_source_ref
|
||||
|
||||
|
|
@ -958,7 +967,12 @@ class RepoPullRequestsView(RepoAppView, DataGridAppView):
|
|||
if not target_perm:
|
||||
raise HTTPNotFound()
|
||||
|
||||
return PullRequestModel().generate_repo_data(repo, translator=self.request.translate)
|
||||
# Get the target branch pre-population setting for the target repo
|
||||
prepopulate_target_branch = self._get_repo_setting(repo, "pr_target_branch_prepopulate", True)
|
||||
|
||||
return PullRequestModel().generate_repo_data(
|
||||
repo, translator=self.request.translate, prepopulate_branch=prepopulate_target_branch
|
||||
)
|
||||
|
||||
@LoginRequired()
|
||||
@NotAnonymous()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue