From a23b342cb45c67674366e2dd2df3d4d4f5c619c5 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 4 Mar 2025 17:56:21 +0800 Subject: [PATCH 1/2] fix --- options/locale/locale_en-US.ini | 2 +- .../issue/sidebar/issue_dependencies.tmpl | 47 ++-- templates/repo/issue/sidebar/wip_switch.tmpl | 8 +- templates/repo/issue/view_content/pull.tmpl | 4 +- .../view_content/pull_merge_instruction.tmpl | 98 ++++---- .../view_content/update_branch_by_merge.tmpl | 2 +- web_src/js/features/repo-issue.ts | 237 ++++++++---------- web_src/js/features/repo-legacy.ts | 6 +- web_src/js/index.ts | 14 +- 9 files changed, 189 insertions(+), 229 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 1da2fb61ad41a..4f1db5da6a750 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1938,7 +1938,7 @@ 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.cmd_instruction_hint = `View command line instructions.` +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 diff --git a/templates/repo/issue/sidebar/issue_dependencies.tmpl b/templates/repo/issue/sidebar/issue_dependencies.tmpl index 17e9738c6f77a..bbae0119584b3 100644 --- a/templates/repo/issue/sidebar/issue_dependencies.tmpl +++ b/templates/repo/issue/sidebar/issue_dependencies.tmpl @@ -31,7 +31,9 @@
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - + {{svg "octicon-trash" 16}} {{end}} @@ -63,7 +65,9 @@
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - + {{svg "octicon-trash" 16}} {{end}} @@ -86,7 +90,9 @@
{{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}} - + {{svg "octicon-trash" 16}} {{end}} @@ -106,7 +112,7 @@
{{$.CsrfTokenHtml}}
- {{else if .IsPullWorkInProgress}} -
+
{{svg "octicon-x"}} {{ctx.Locale.Tr "repo.pulls.cannot_merge_work_in_progress"}}
{{if or .HasIssuesOrPullsWritePermission .IsIssuePoster}} - {{end}} diff --git a/templates/repo/issue/view_content/pull_merge_instruction.tmpl b/templates/repo/issue/view_content/pull_merge_instruction.tmpl index 9a3e2cb7d7554..a1cff41a3a2bb 100644 --- a/templates/repo/issue/view_content/pull_merge_instruction.tmpl +++ b/templates/repo/issue/view_content/pull_merge_instruction.tmpl @@ -1,55 +1,57 @@
-
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}
-
-

{{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 .PullRequest.Flow 0}} -
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
- {{else}} -
git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}
+
+ {{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}} +
+

{{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}} -
git checkout {{$localBranch}}
-
- {{if .ShowMergeInstructions}} -
-

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

- {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} - {{if not .AutodetectManualMerge}} -
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}
- {{end}} -
-
-
-
git checkout {{.PullRequest.BaseBranch}}
-
git merge --no-ff {{$localBranch}}
-
-
-
git checkout {{.PullRequest.BaseBranch}}
-
git merge --ff-only {{$localBranch}}
-
-
+
+ {{if eq .PullRequest.Flow 0}} +
git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}{{else}}origin{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}
+ {{else}} +
git fetch -u origin {{.PullRequest.GetGitRefName}}:{{$localBranch}}
+ {{end}}
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 --ff-only {{$localBranch}}
+ {{if .ShowMergeInstructions}} +
+

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

+ {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}} + {{if not .AutodetectManualMerge}} +
{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}
+ {{end}}
-
-
git checkout {{.PullRequest.BaseBranch}}
-
git merge {{$localBranch}}
+
+
+
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 --ff-only {{$localBranch}}
+
+
+
git checkout {{.PullRequest.BaseBranch}}
+
git merge {{$localBranch}}
+
+
git push origin {{.PullRequest.BaseBranch}}
-
git push origin {{.PullRequest.BaseBranch}}
+ {{end}}
- {{end}} -
+
diff --git a/templates/repo/issue/view_content/update_branch_by_merge.tmpl b/templates/repo/issue/view_content/update_branch_by_merge.tmpl index adce052deeba1..e0ed262f173fe 100644 --- a/templates/repo/issue/view_content/update_branch_by_merge.tmpl +++ b/templates/repo/issue/view_content/update_branch_by_merge.tmpl @@ -8,7 +8,7 @@
{{if and $.UpdateAllowed $.UpdateByRebaseAllowed}}
-
+