gitea源码

pull_merge_instruction.tmpl 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <div class="divider"></div>
  2. <details>
  3. <summary>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_hint"}}</summary>
  4. <div class="tw-mt-2">
  5. <div><h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_title"}}</h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_checkout_desc"}}</div>
  6. {{$localBranch := .PullRequest.HeadBranch}}
  7. {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}
  8. {{$localBranch = print .PullRequest.HeadRepo.OwnerName "-" .PullRequest.HeadBranch}}
  9. {{end}}
  10. <div class="ui secondary segment tw-font-mono">
  11. {{$gitRemoteName := ctx.RootData.SystemConfig.Repository.GitGuideRemoteName.Value ctx}}
  12. {{if eq .PullRequest.Flow 0}}
  13. <div>git fetch -u {{if ne .PullRequest.HeadRepo.ID .PullRequest.BaseRepo.ID}}<origin-url data-url="{{.PullRequest.HeadRepo.Link}}"></origin-url>{{else}}{{$gitRemoteName}}{{end}} {{.PullRequest.HeadBranch}}:{{$localBranch}}</div>
  14. {{else}}
  15. <div>git fetch -u {{$gitRemoteName}} {{.PullRequest.GetGitHeadRefName}}:{{$localBranch}}</div>
  16. {{end}}
  17. <div>git checkout {{$localBranch}}</div>
  18. </div>
  19. {{if .ShowMergeInstructions}}
  20. <div>
  21. <h3>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_title"}}</h3>
  22. {{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_desc"}}
  23. {{if not .AutodetectManualMerge}}
  24. <div>{{ctx.Locale.Tr "repo.pulls.cmd_instruction_merge_warning"}}</div>
  25. {{end}}
  26. </div>
  27. <div class="ui secondary segment tw-font-mono">
  28. <div data-pull-merge-style="merge">
  29. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  30. <div>git merge --no-ff {{$localBranch}}</div>
  31. </div>
  32. <div class="tw-hidden" data-pull-merge-style="rebase">
  33. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  34. <div>git merge --ff-only {{$localBranch}}</div>
  35. </div>
  36. <div class="tw-hidden" data-pull-merge-style="rebase-merge">
  37. <div>git checkout {{$localBranch}}</div>
  38. <div>git rebase {{.PullRequest.BaseBranch}}</div>
  39. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  40. <div>git merge --no-ff {{$localBranch}}</div>
  41. </div>
  42. <div class="tw-hidden" data-pull-merge-style="squash">
  43. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  44. <div>git merge --squash {{$localBranch}}</div>
  45. </div>
  46. <div class="tw-hidden" data-pull-merge-style="fast-forward-only">
  47. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  48. <div>git merge --ff-only {{$localBranch}}</div>
  49. </div>
  50. <div class="tw-hidden" data-pull-merge-style="manually-merged">
  51. <div>git checkout {{.PullRequest.BaseBranch}}</div>
  52. <div>git merge {{$localBranch}}</div>
  53. </div>
  54. <div>git push {{$gitRemoteName}} {{.PullRequest.BaseBranch}}</div>
  55. </div>
  56. {{end}}
  57. </div>
  58. </details>