|
|
@ -251,8 +251,14 @@ |
|
|
|
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }} |
|
|
|
{{$.i18n.Tr (printf "repo.signing.wont_sign.%s" .WontSignReason) }} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
|
|
|
|
|
|
|
|
{{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} |
|
|
|
{{$notAllOverridableChecksOk := or .IsBlockedByApprovals .IsBlockedByRejection .IsBlockedByOfficialReviewRequests .IsBlockedByOutdatedBranch .IsBlockedByChangedProtectedFiles (and .EnableStatusCheck (not .RequiredStatusCheckState.IsSuccess))}} |
|
|
|
{{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} |
|
|
|
|
|
|
|
|
|
|
|
{{/* admin can merge without checks, writer can merge when checkes succeed */}} |
|
|
|
|
|
|
|
{{$canMergeNow := and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} |
|
|
|
|
|
|
|
{{/* admin and writer both can make an auto merge schedule */}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{{if $canMergeNow}} |
|
|
|
{{if $notAllOverridableChecksOk}} |
|
|
|
{{if $notAllOverridableChecksOk}} |
|
|
|
<div class="item"> |
|
|
|
<div class="item"> |
|
|
|
<i class="icon icon-octicon">{{svg "octicon-dot-fill"}}</i> |
|
|
|
<i class="icon icon-octicon">{{svg "octicon-dot-fill"}}</i> |
|
|
@ -277,7 +283,6 @@ |
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
|
|
|
|
|
|
|
|
{{$canAutoMerge = true}} |
|
|
|
|
|
|
|
{{if (gt .Issue.PullRequest.CommitsBehind 0)}} |
|
|
|
{{if (gt .Issue.PullRequest.CommitsBehind 0)}} |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="item item-section"> |
|
|
|
<div class="item item-section"> |
|
|
@ -317,14 +322,16 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
|
|
|
|
|
|
|
|
{{if and (or $.IsRepoAdmin (not $notAllOverridableChecksOk)) (or (not .AllowMerge) (not .RequireSigned) .WillSign)}} |
|
|
|
{{if .AllowMerge}} {{/* user is allowed to merge */}} |
|
|
|
{{if .AllowMerge}} |
|
|
|
|
|
|
|
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} |
|
|
|
{{$prUnit := .Repository.MustGetUnit $.UnitTypePullRequests}} |
|
|
|
{{$approvers := .Issue.PullRequest.GetApprovers}} |
|
|
|
{{$approvers := .Issue.PullRequest.GetApprovers}} |
|
|
|
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} |
|
|
|
{{if or $prUnit.PullRequestsConfig.AllowMerge $prUnit.PullRequestsConfig.AllowRebase $prUnit.PullRequestsConfig.AllowRebaseMerge $prUnit.PullRequestsConfig.AllowSquash}} |
|
|
|
|
|
|
|
{{$hasPendingPullRequestMergeTip := ""}} |
|
|
|
|
|
|
|
{{if .HasPendingPullRequestMerge}} |
|
|
|
|
|
|
|
{{$createdPRMergeStr := TimeSinceUnix .PendingPullRequestMerge.CreatedUnix $.i18n.Lang}} |
|
|
|
|
|
|
|
{{$hasPendingPullRequestMergeTip = $.i18n.Tr "repo.pulls.auto_merge_has_pending_schedule" .PendingPullRequestMerge.Doer.Name $createdPRMergeStr}} |
|
|
|
|
|
|
|
{{end}} |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="ui divider"></div> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
<!-- /* eslint-disable */ --> |
|
|
|
<!-- /* eslint-disable */ --> |
|
|
|
(() => { |
|
|
|
(() => { |
|
|
@ -335,13 +342,22 @@ |
|
|
|
'baseLink': {{.Link}}, |
|
|
|
'baseLink': {{.Link}}, |
|
|
|
'textCancel': {{$.i18n.Tr "cancel"}}, |
|
|
|
'textCancel': {{$.i18n.Tr "cancel"}}, |
|
|
|
'textDeleteBranch': {{$.i18n.Tr "repo.branch.delete" .HeadTarget}}, |
|
|
|
'textDeleteBranch': {{$.i18n.Tr "repo.branch.delete" .HeadTarget}}, |
|
|
|
|
|
|
|
'textAutoMergeButtonWhenSucceed': {{$.i18n.Tr "repo.pulls.auto_merge_button_when_succeed"}}, |
|
|
|
|
|
|
|
'textAutoMergeWhenSucceed': {{$.i18n.Tr "repo.pulls.auto_merge_when_succeed"}}, |
|
|
|
|
|
|
|
'textAutoMergeCancelSchedule': {{$.i18n.Tr "repo.pulls.auto_merge_cancel_schedule"}}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'canMergeNow': {{$canMergeNow}}, |
|
|
|
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, |
|
|
|
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, |
|
|
|
'pullHeadCommitID': {{.PullHeadCommitID}}, |
|
|
|
'pullHeadCommitID': {{.PullHeadCommitID}}, |
|
|
|
'isPullBranchDeletable': {{.IsPullBranchDeletable}}, |
|
|
|
'isPullBranchDeletable': {{.IsPullBranchDeletable}}, |
|
|
|
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, |
|
|
|
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, |
|
|
|
'mergeMessageFieldPlaceHolder': {{$.i18n.Tr "repo.editor.commit_message_desc"}}, |
|
|
|
'mergeMessageFieldPlaceHolder': {{$.i18n.Tr "repo.editor.commit_message_desc"}}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'hasPendingPullRequestMerge': {{.HasPendingPullRequestMerge}}, |
|
|
|
|
|
|
|
'hasPendingPullRequestMergeTip': {{$hasPendingPullRequestMergeTip}}, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const generalHideAutoMerge = mergeForm.canMergeNow && mergeForm.allOverridableChecksOk; // if this PR can be merged now, then hide the auto merge |
|
|
|
mergeForm['mergeStyles'] = [ |
|
|
|
mergeForm['mergeStyles'] = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'merge', |
|
|
|
'name': 'merge', |
|
|
@ -349,12 +365,14 @@ |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_pull_request"}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_pull_request"}}, |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'rebase', |
|
|
|
'name': 'rebase', |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}}, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}, |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'rebase-merge', |
|
|
|
'name': 'rebase-merge', |
|
|
@ -362,6 +380,7 @@ |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}, |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'squash', |
|
|
|
'name': 'squash', |
|
|
@ -369,12 +388,14 @@ |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}, |
|
|
|
'mergeTitleFieldText': defaultSquashMergeTitle, |
|
|
|
'mergeTitleFieldText': defaultSquashMergeTitle, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
|
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'name': 'manually-merged', |
|
|
|
'name': 'manually-merged', |
|
|
|
'allowed': {{and $prUnit.PullRequestsConfig.AllowManualMerge $.IsRepoAdmin}}, |
|
|
|
'allowed': {{and $prUnit.PullRequestsConfig.AllowManualMerge $.IsRepoAdmin}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_manually"}}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_manually"}}, |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
|
|
|
|
'hideAutoMerge': true, |
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
]; |
|
|
|
window.config.pageData.pullRequestMergeForm = mergeForm; |
|
|
|
window.config.pageData.pullRequestMergeForm = mergeForm; |
|
|
@ -384,27 +405,10 @@ |
|
|
|
<div id="pull-request-merge-form"></div> |
|
|
|
<div id="pull-request-merge-form"></div> |
|
|
|
|
|
|
|
|
|
|
|
{{if .ShowMergeInstructions}} |
|
|
|
{{if .ShowMergeInstructions}} |
|
|
|
<div class="instruct-toggle mt-3"> {{$.i18n.Tr "repo.pulls.merge_instruction_hint" | Safe}} </div> |
|
|
|
{{template "repo/issue/view_content/pull_merge_instruction" (dict "i18n" .i18n "Issue" .Issue)}} |
|
|
|
<div class="instruct-content" style="display:none"> |
|
|
|
|
|
|
|
<div class="ui divider"></div> |
|
|
|
|
|
|
|
<div><h3 class="di">{{$.i18n.Tr "step1"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step1_desc"}}</div> |
|
|
|
|
|
|
|
<div class="ui secondary segment"> |
|
|
|
|
|
|
|
{{if eq .Issue.PullRequest.Flow 0}} |
|
|
|
|
|
|
|
<div>git checkout -b {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}} {{.Issue.PullRequest.BaseBranch}}</div> |
|
|
|
|
|
|
|
<div>git pull {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.HTMLURL}}{{else}}origin{{end}} {{.Issue.PullRequest.HeadBranch}}</div> |
|
|
|
|
|
|
|
{{else}} |
|
|
|
|
|
|
|
<div>git fetch origin {{.Issue.PullRequest.GetGitRefName}}:{{.Issue.PullRequest.HeadBranch}}</div> |
|
|
|
|
|
|
|
{{end}} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div><h3 class="di">{{$.i18n.Tr "step2"}} </h3>{{$.i18n.Tr "repo.pulls.merge_instruction_step2_desc"}}</div> |
|
|
|
|
|
|
|
<div class="ui secondary segment"> |
|
|
|
|
|
|
|
<div>git checkout {{.Issue.PullRequest.BaseBranch}}</div> |
|
|
|
|
|
|
|
<div>git merge --no-ff {{if ne .Issue.PullRequest.HeadRepo.ID .Issue.PullRequest.BaseRepo.ID}}{{.Issue.PullRequest.HeadRepo.OwnerName}}-{{end}}{{.Issue.PullRequest.HeadBranch}}</div> |
|
|
|
|
|
|
|
<div>git push origin {{.Issue.PullRequest.BaseBranch}}</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{{end}} |
|
|
|
{{end}} |
|
|
|
{{else}} |
|
|
|
{{else}} |
|
|
|
|
|
|
|
{{/* no merge style was set in repo setting: not or ($prUnit.PullRequestsConfig.AllowMerge ...) */}} |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="item text red"> |
|
|
|
<div class="item text red"> |
|
|
|
{{svg "octicon-x"}} |
|
|
|
{{svg "octicon-x"}} |
|
|
@ -414,15 +418,15 @@ |
|
|
|
{{svg "octicon-info"}} |
|
|
|
{{svg "octicon-info"}} |
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_helper"}} |
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_helper"}} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
{{end}} {{/* end if the repo was set to use any merge style */}} |
|
|
|
{{else}} |
|
|
|
{{else}} |
|
|
|
|
|
|
|
{{/* user is not allowed to merge */}} |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="ui divider"></div> |
|
|
|
<div class="item"> |
|
|
|
<div class="item"> |
|
|
|
{{svg "octicon-info"}} |
|
|
|
{{svg "octicon-info"}} |
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_access"}} |
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_access"}} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
{{end}} {{/* end if user is allowed to merge or not */}} |
|
|
|
{{end}} |
|
|
|
|
|
|
|
{{else}} |
|
|
|
{{else}} |
|
|
|
{{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} |
|
|
|
{{/* Merge conflict without specific file. Suggest manual merge, only if all reviews and status checks OK. */}} |
|
|
|
{{if .IsBlockedByApprovals}} |
|
|
|
{{if .IsBlockedByApprovals}} |
|
|
|