diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index e3f2fcdd8..8dcce73b7 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -110,9 +110,6 @@ write = Write preview = Preview loading = Loading… -step1 = Step 1: -step2 = Step 2: - error = Error error404 = The page you are trying to reach either does not exist or you are not authorized to view it. go_back = Go Back @@ -1797,9 +1794,11 @@ pulls.outdated_with_base_branch = This branch is out-of-date with the base branc pulls.close = Close Pull Request pulls.closed_at = `closed this pull request %[2]s` pulls.reopened_at = `reopened this pull request %[2]s` -pulls.merge_instruction_hint = `You can also view command line instructions.` -pulls.merge_instruction_step1_desc = From your project repository, check out a new branch and test the changes. -pulls.merge_instruction_step2_desc = Merge the changes and update on Gitea. +pulls.cmd_instruction_hint = `View command line instructions.` +pulls.cmd_instruction_checkout_title = Checkout +pulls.cmd_instruction_checkout_desc = From your project repository, check out a new branch and test the changes. +pulls.cmd_instruction_merge_title = Merge +pulls.cmd_instruction_merge_desc = Merge the changes and update on Gitea. pulls.clear_merge_message = Clear merge message pulls.clear_merge_message_hint = Clearing the merge message will only remove the commit message content and keep generated git trailers such as "Co-Authored-By …". diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index a4f7ede74..2fed5848d 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -372,8 +372,8 @@ {{end}} - {{if and .ShowMergeInstructions .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} - {{template "repo/issue/view_content/pull_merge_instruction" .Issue.PullRequest}} + {{if and .Issue.PullRequest.HeadRepo (not .Issue.PullRequest.HasMerged) (not .Issue.IsClosed)}} + {{template "repo/issue/view_content/pull_merge_instruction" dict "PullRequest" .Issue.PullRequest "ShowMergeInstructions" .ShowMergeInstructions}} {{end}} diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index b1b52645e..3dab44710 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,19 +1,45 @@
-
{{ctx.Locale.Tr "repo.pulls.merge_instruction_hint" | Safe}}
+
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint" | Safe}}
-

{{ctx.Locale.Tr "step1"}}

{{ctx.Locale.Tr "repo.pulls.merge_instruction_step1_desc"}}
+

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}
+ {{$localBranch := .PullRequest.HeadBranch}} + {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}} + {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}} + {{end}}
- {{if eq .Flow 0}} -
git checkout -b {{if ne .HeadRepo.ID .BaseRepo.ID}}{{.HeadRepo.OwnerName}}-{{end}}{{.HeadBranch}} {{.BaseBranch}}
-
git pull {{if ne .HeadRepo.ID .BaseRepo.ID}}{{else}}origin{{end}} {{.HeadBranch}}
+ {{if eq .PullRequest.Flow 0}} +
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
+
git checkout {{$localBranch}}
{{else}} -
git fetch origin {{.GetGitRefName}}:{{.HeadBranch}}
+
git fetch -u origin {{.GetGitRefName}}:{{$localBranch}}
{{end}}
-

{{ctx.Locale.Tr "step2"}}

{{ctx.Locale.Tr "repo.pulls.merge_instruction_step2_desc"}}
+ {{if .ShowMergeInstructions}} +

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}

{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
-
git checkout {{.BaseBranch}}
-
git merge --no-ff {{if ne .HeadRepo.ID .BaseRepo.ID}}{{.HeadRepo.OwnerName}}-{{end}}{{.HeadBranch}}
-
git push origin {{.BaseBranch}}
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --no-ff {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --ff-only {{$localBranch}}
+
+
+
git checkout {{$localBranch}}
+
git rebase {{.PullRequest.BaseBranch}}
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --no-ff {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge --squash {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge {{$localBranch}}
+
+
git push origin {{.PullRequest.BaseBranch}}
+ {{end}}
diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 03d1f9968..54dcf9d86 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -1,5 +1,6 @@