|
|
@ -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,112 +322,111 @@ |
|
|
|
</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> |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
<!-- /* eslint-disable */ --> |
|
|
|
|
|
|
|
(() => { |
|
|
|
|
|
|
|
const defaultMergeTitle = {{.DefaultMergeMessage}}; |
|
|
|
|
|
|
|
const defaultSquashMergeTitle = {{.DefaultSquashMergeMessage}}; |
|
|
|
|
|
|
|
const defaultMergeMessage = 'Reviewed-on: ' + {{$.Issue.HTMLURL}} + '\n' + {{$approvers}}; |
|
|
|
|
|
|
|
const mergeForm = { |
|
|
|
|
|
|
|
'baseLink': {{.Link}}, |
|
|
|
|
|
|
|
'textCancel': {{$.i18n.Tr "cancel"}}, |
|
|
|
|
|
|
|
'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"}}, |
|
|
|
|
|
|
|
|
|
|
|
<div class="ui divider"></div> |
|
|
|
'canMergeNow': {{$canMergeNow}}, |
|
|
|
|
|
|
|
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, |
|
|
|
|
|
|
|
'pullHeadCommitID': {{.PullHeadCommitID}}, |
|
|
|
|
|
|
|
'isPullBranchDeletable': {{.IsPullBranchDeletable}}, |
|
|
|
|
|
|
|
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, |
|
|
|
|
|
|
|
'mergeMessageFieldPlaceHolder': {{$.i18n.Tr "repo.editor.commit_message_desc"}}, |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
'hasPendingPullRequestMerge': {{.HasPendingPullRequestMerge}}, |
|
|
|
<!-- /* eslint-disable */ --> |
|
|
|
'hasPendingPullRequestMergeTip': {{$hasPendingPullRequestMergeTip}}, |
|
|
|
(() => { |
|
|
|
}; |
|
|
|
const defaultMergeTitle = {{.DefaultMergeMessage}}; |
|
|
|
|
|
|
|
const defaultSquashMergeTitle = {{.DefaultSquashMergeMessage}}; |
|
|
|
|
|
|
|
const defaultMergeMessage = 'Reviewed-on: ' + {{$.Issue.HTMLURL}} + '\n' + {{$approvers}}; |
|
|
|
|
|
|
|
const mergeForm = { |
|
|
|
|
|
|
|
'baseLink': {{.Link}}, |
|
|
|
|
|
|
|
'textCancel': {{$.i18n.Tr "cancel"}}, |
|
|
|
|
|
|
|
'textDeleteBranch': {{$.i18n.Tr "repo.branch.delete" .HeadTarget}}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'allOverridableChecksOk': {{not $notAllOverridableChecksOk}}, |
|
|
|
const generalHideAutoMerge = mergeForm.canMergeNow && mergeForm.allOverridableChecksOk; // if this PR can be merged now, then hide the auto merge |
|
|
|
'pullHeadCommitID': {{.PullHeadCommitID}}, |
|
|
|
mergeForm['mergeStyles'] = [ |
|
|
|
'isPullBranchDeletable': {{.IsPullBranchDeletable}}, |
|
|
|
{ |
|
|
|
'defaultDeleteBranchAfterMerge': {{$prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge}}, |
|
|
|
'name': 'merge', |
|
|
|
'mergeMessageFieldPlaceHolder': {{$.i18n.Tr "repo.editor.commit_message_desc"}}, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowMerge}}, |
|
|
|
}; |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_pull_request"}}, |
|
|
|
mergeForm['mergeStyles'] = [ |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
{ |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'name': 'merge', |
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowMerge}}, |
|
|
|
}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.merge_pull_request"}}, |
|
|
|
{ |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'name': 'rebase', |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}}, |
|
|
|
}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}, |
|
|
|
{ |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
'name': 'rebase', |
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebase}}, |
|
|
|
}, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_pull_request"}}, |
|
|
|
{ |
|
|
|
'hideMergeMessageTexts': true, |
|
|
|
'name': 'rebase-merge', |
|
|
|
}, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebaseMerge}}, |
|
|
|
{ |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}, |
|
|
|
'name': 'rebase-merge', |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowRebaseMerge}}, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.rebase_merge_commit_pull_request"}}, |
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
'mergeTitleFieldText': defaultMergeTitle, |
|
|
|
}, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
{ |
|
|
|
}, |
|
|
|
'name': 'squash', |
|
|
|
{ |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}}, |
|
|
|
'name': 'squash', |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}, |
|
|
|
'allowed': {{$prUnit.PullRequestsConfig.AllowSquash}}, |
|
|
|
'mergeTitleFieldText': defaultSquashMergeTitle, |
|
|
|
'textDoMerge': {{$.i18n.Tr "repo.pulls.squash_merge_pull_request"}}, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
'mergeTitleFieldText': defaultSquashMergeTitle, |
|
|
|
'hideAutoMerge': generalHideAutoMerge, |
|
|
|
'mergeMessageFieldText': defaultMergeMessage, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
'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; |
|
|
|
})(); |
|
|
|
})(); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<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}} |
|
|
|
|
|
|
|
{{else}} |
|
|
|
|
|
|
|
<div class="ui divider"></div> |
|
|
|
|
|
|
|
<div class="item text red"> |
|
|
|
|
|
|
|
{{svg "octicon-x"}} |
|
|
|
|
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_desc"}} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="item"> |
|
|
|
|
|
|
|
{{svg "octicon-info"}} |
|
|
|
|
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_helper"}} |
|
|
|
|
|
|
|
</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"> |
|
|
|
|
|
|
|
{{svg "octicon-x"}} |
|
|
|
|
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_desc"}} |
|
|
|
|
|
|
|
</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_helper"}} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{end}} |
|
|
|
{{end}} {{/* end if the repo was set to use any merge style */}} |
|
|
|
{{end}} |
|
|
|
{{else}} |
|
|
|
|
|
|
|
{{/* user is not allowed to merge */}} |
|
|
|
|
|
|
|
<div class="ui divider"></div> |
|
|
|
|
|
|
|
<div class="item"> |
|
|
|
|
|
|
|
{{svg "octicon-info"}} |
|
|
|
|
|
|
|
{{$.i18n.Tr "repo.pulls.no_merge_access"}} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
{{end}} {{/* end if user is allowed to merge or not */}} |
|
|
|
{{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}} |
|
|
|