@@ -3,8 +3,9 @@
issue: gitbucket.core.model.Issue,
issue: gitbucket.core.model.Issue,
pullreq: gitbucket.core.model.PullRequest,
pullreq: gitbucket.core.model.PullRequest,
statuses: List[model.CommitStatus],
statuses: List[model.CommitStatus],
r epository: gitbucket.core.service.RepositoryService.RepositoryInfo,
originR epository: gitbucket.core.service.RepositoryService.RepositoryInfo,
requestRepositoryUrl: String )(implicit context: gitbucket.core.controller.Context)
forkedRepository: gitbucket.core.service.RepositoryService.RepositoryInfo )(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.service.SystemSettingsService
@import context._
@import context._
@import gitbucket.core.view.helpers._
@import gitbucket.core.view.helpers._
@import model.CommitState
@import model.CommitState
@@ -22,102 +23,101 @@
@status.description.map{ desc => < span class = "muted" > — @desc< / span > }
@status.description.map{ desc => < span class = "muted" > — @desc< / span > }
< / div >
< / div >
}
}
}else{
} else {
@defining(statuses.groupBy(_.state)){ stateMap => @defining(CommitState.combine(stateMap.keySet)){ state =>
@defining(statuses.groupBy(_.state)){ stateMap =>
< div class = "build-status-item" >
@defining(CommitState.combine(stateMap.keySet)){ state =>
< a class = "pull-right" id = "toggle-all-checks" > < / a >
< span class = "build-status-icon text-@{state.name}" > @commitStateIcon(state)< / span >
< strong class = "text-@{state.name}" > @commitStateText(state, pullreq.commitIdTo)< / strong >
< span class = "text-@{state.name}" > — @{stateMap.map{ case (keyState, states) => states.size+" "+keyState.name }.mkString(", ")} checks< / span >
< / div >
< div class = "build-statuses-list" style = "@if(state==CommitState.SUCCESS){ display:none; }else{ }" >
@statuses.map{ status =>
< div class = "build-status-item" >
< div class = "build-status-item" >
@status.targetUrl.map{ url => < a class = "pull-right" href = "@url" > Details < / a > }
< a class = "pull-right" id = "toggle-all-checks" > < / a >
< span class = "build-status-icon text-@{status. state.name}" > @commitStateIcon(status. state)< / span >
< span class = "build-status-icon text-@{state.name}" > @commitStateIcon(state)< / span >
< span class = "text-@{status. state.name}" > @status.context < / span >
< strong class = "text-@{state.name}" > @commitStateText(state, pullreq.commitIdTo) < / strong >
@status.description.map{ desc => < span class = "muted" > — @desc < / span > }
< span class = "text-@{state.name}" > — @{stateMap.map{ case (keyState, states) => states.size+" "+keyState.name }.mkString(", ")} checks< / span >
< / div >
< / div >
}
< div class = "build-statuses-list" style = "@if(state==CommitState.SUCCESS){ display:none; }else{ }" >
< / div >
@statuses.map{ status =>
} }
< div class = "build-status-item" >
@status.targetUrl.map{ url => < a class = "pull-right" href = "@url" > Details< / a > }
< span class = "build-status-icon text-@{status.state.name}" > @commitStateIcon(status.state)< / span >
< span class = "text-@{status.state.name}" > @status.context< / span >
@status.description.map{ desc => < span class = "muted" > — @desc< / span > }
< / div >
}
< / div >
}
}
}
}
< / div >
< / div >
}
}
< div class = "pull-right" >
< div class = "pull-right" >
< input type = "button" class = "btn @if(!hasProblem){ btn-success }" id = "merge-pull-request-button" value = "Merge pull request" @ if ( hasConflict ) { disabled = "true" } / >
< input type = "button" class = "btn @if(!hasProblem){ btn-success }" id = "merge-pull-request-button" value = "Merge pull request" @ if ( hasConflict ) { disabled = "true" } / >
< / div >
< / div >
< div >
< div >
@if(hasConflict){
@if(hasConflict){
< span class = "strong" > We can’ t automatically merge this pull request.< / span >
< span class = "strong" > We can’ t automatically merge this pull request.< / span >
} else{ @if(hasProblem) {
} else {
< span class = "strong" > Merge with caution!< / span >
@if(hasProblem){
} else {
< span class = "strong" > Merge with caution!< / span >
< span class = "strong" > This pull request can be automatically merged.< / span >
} else {
} }
< span class = "strong" > This pull request can be automatically merged.< / span >
< / div >
}
< div class = "small" >
}
@if(hasConflict){
< / div >
< a href = "#" id = "show-command-line" > Use the command line< / a > to resolve conflicts before continuing.
< div class = "small" >
} else {
@if(hasConflict) {
You can also merge branches on the < a href = "#" id = "show-command-line" > command line< / a > .
< a href = "#" id = "show-command-line" > Use the command line< / a > to resolve conflicts before continuing .
}
} else {
< / div >
You can also merge branches on the < a href = "#" id = "show-command-line" > command line < / a > .
< div id = "command-line" style = "display: none;" >
}
< hr >
< / div >
@if(hasConflict){
< div id = "command-line" style = "display: none;" >
< span class = "strong" > Checkout via command line< / span >
< hr >
< p >
@if(hasConflict){
If you cannot merge a pull request automatically here, you have the option of checking
< span class = "strong" > Checkout via command line< / span >
it out via command line to resolve conflicts and perform a manual merge.
< p >
< / p >
If you cannot merge a pull request automatically here, you have the option of checking
} else {
it out via command line to resolve conflicts and perform a manual merge.
< span class = "strong" > Merging via command line< / span >
< / p >
< p >
} else {
If you do not want to use the merge button or an automatic merge cannot be performed,
< span class = "strong" > Merging via command line< / span >
you can perform a manual merge on the command line.
< p >
< / p >
If you do not want to use the merge button or an automatic merge cannot be performed,
}
you can perform a manual merge on the command line.
@helper.html.copy("repository-url-copy", requestRepositoryUrl){
< / p >
< input type = "text" style = "width: 500px;" value = "@requestRepositoryUrl" id = "repository-url" readonly >
}
}
@helper.html.copy("repository-url-copy", forkedRepository.httpUrl, true){
< div >
< div class = "btn-group" data-toggle = "buttons-radio" >
< p >
< button class = "btn btn-small active" type = "button" id = "repository-url-http" > HTTP< / button >
< span class = "strong" > Step 1:< / span > From your project repository, check out a new branch and test the changes.
@if(settings.ssh & & loginAccount.isDefined){
< / p >
< button class = "btn btn-small" type = "button" id = "repository-url-ssh" style = "border-radius: 0px;" > SSH< / button >
@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\ngit pull ${requestRepositoryUrl} ${pullreq.requestBranch}"){ command =>
}
@helper.html.copy("merge-command-copy-1", command){
< / div >
< pre style = "width: 500px; float: left;" > @command< / pre >
< input type = "text" style = "width: 500px;" value = "@forkedRepository.httpUrl" id = "repository-url" readonly >
}
}
}
< div >
< / div >
< p >
@*
< span class = "strong" > Step 1:< / span > From your project repository, check out a new branch and test the changes.
< div >
< / p >
< p >
@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" +
< span class = "strong" > Step 2:< / span > Bring in @{pullreq.requestUserName}'s changes and test
s"git pull ${forkedRepository.httpUrl} ${pullreq.requestBranch}"){ command =>
< / p >
@helper.html.copy("merge-command-copy-1", command){
@defining(s"git pull ${requestRepositoryUrl} ${pullreq.requestBranch}"){ command =>
< pre style = "width: 600px; float: left; font-size: 12px; border-radius: 3px 0px 3px 3px;" id = "merge-command" > @Html(command)< / pre >
@helper.html.copy("merge-command-copy-2", command){
}
< pre style = "width: 500px; float: left;" > @command< / pre >
}
}
< / div >
}
< div >
< / div >
< p >
*@
< span class = "strong" > Step 2:< / span > Merge the changes and update on the server.
< div >
< / p >
< p >
@defining(s"git checkout ${pullreq.branch}\ngit merge --no-ff ${pullreq.requestUserName}-${pullreq.requestBranch}\n" +
< span class = "strong" > Step 2:< / span > Merge the changes and update on the server.
s"git push origin ${pullreq.branch}"){ command =>
< / p >
@helper.html.copy("merge-command-copy-2", command){
@defining(s"git checkout ${pullreq.branch}\ngit merge --no-ff ${pullreq.requestUserName}-${pullreq.requestBranch}\ngit push origin ${pullreq.branch}"){ command =>
< pre style = "width: 600px; float: left; font-size: 12px; border-radius: 3px 0px 3px 3px;" > @command< / pre >
@helper.html.copy("merge-command-copy-2", command){
}
< pre style = "width: 500px; float: left;" > @command< / pre >
}
}
< / div >
}
< / div >
< / div >
< / div >
< / div >
< / div >
< div id = "confirm-merge-form" style = "display: none;" >
< div id = "confirm-merge-form" style = "display: none;" >
< form method = "POST" action = "@url(r epository)/pull/@pullreq.issueId/merge" >
< form method = "POST" action = "@url(originR epository)/pull/@pullreq.issueId/merge" >
< div class = "strong" >
< div class = "strong" >
Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
< / div >
< / div >
@@ -151,5 +151,31 @@ $(function(){
$ ( '#merge-pull-request' ) . hide ( ) ;
$ ( '#merge-pull-request' ) . hide ( ) ;
$ ( '#confirm-merge-form' ) . show ( ) ;
$ ( '#confirm-merge-form' ) . show ( ) ;
} ) ;
} ) ;
@ if ( settings . ssh && loginAccount . isDefined ) {
$ ( '#repository-url-http' ) . click ( function ( ) {
// Update URL box
$ ( '#repository-url' ) . val ( '@forkedRepository.httpUrl' ) ;
$ ( '#repository-url-copy' ) . attr ( 'data-clipboard-text' , $ ( '#repository-url' ) . val ( ) ) ;
// Update command guidance
$ ( '#merge-command' ) . text ( $ ( '#merge-command' ) . text ( ) . replace (
'@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)' ,
'@forkedRepository.httpUrl'
) ) ;
$ ( '#merge-command-copy-1' ) . attr ( 'data-clipboard-text' , $ ( '#merge-command' ) . text ( ) ) ;
} ) ;
$ ( '#repository-url-ssh' ) . click ( function ( ) {
// Update URL box
$ ( '#repository-url' ) . val ( '@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)' ) ;
$ ( '#repository-url-copy' ) . attr ( 'data-clipboard-text' , $ ( '#repository-url' ) . val ( ) ) ;
// Update command guidance
$ ( '#merge-command' ) . text ( $ ( '#merge-command' ) . text ( ) . replace (
'@forkedRepository.httpUrl' ,
'@forkedRepository.sshUrl(settings.sshPort.getOrElse(SystemSettingsService.DefaultSshPort), loginAccount.get.userName)'
) ) ;
$ ( '#merge-command-copy-1' ) . attr ( 'data-clipboard-text' , $ ( '#merge-command' ) . text ( ) ) ;
} ) ;
}
} ) ;
} ) ;
< / script >
< / script >