@@ -3,8 +3,9 @@
issue: gitbucket.core.model.Issue,
pullreq: gitbucket.core.model.PullRequest,
statuses: List[model.CommitStatus],
r epository: gitbucket.core.service.RepositoryService.RepositoryInfo,
requestRepositoryUrl: String )(implicit context: gitbucket.core.controller.Context)
originR epository: gitbucket.core.service.RepositoryService.RepositoryInfo,
forkedRepository: gitbucket.core.service.RepositoryService.RepositoryInfo )(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.service.SystemSettingsService
@import context._
@import gitbucket.core.view.helpers._
@import model.CommitState
@@ -23,7 +24,8 @@
< / div >
}
} else {
@defining(statuses.groupBy(_.state)){ stateMap => @defining(CommitState.combine(stateMap.keySet)){ state =>
@defining(statuses.groupBy(_.state)){ stateMap =>
@defining(CommitState.combine(stateMap.keySet)){ state =>
< div class = "build-status-item" >
< a class = "pull-right" id = "toggle-all-checks" > < / a >
< span class = "build-status-icon text-@{state.name}" > @commitStateIcon(state)< / span >
@@ -40,7 +42,8 @@
< / div >
}
< / div >
} }
}
}
}
< / div >
}
@@ -50,11 +53,13 @@
< div >
@if(hasConflict){
< span class = "strong" > We can’ t automatically merge this pull request.< / span >
} else{ @if(hasProblem) {
} else {
@if(hasProblem){
< span class = "strong" > Merge with caution!< / span >
} else {
< span class = "strong" > This pull request can be automatically merged.< / span >
} }
}
}
< / div >
< div class = "small" >
@if(hasConflict){
@@ -78,46 +83,41 @@
you can perform a manual merge on the command line.
< / p >
}
@helper.html.copy("repository-url-copy", request RepositoryUrl ){
< input type = "text" style = "width: 500px;" value = "@requestRepositoryUrl" id = "repository-url" readonly >
@helper.html.copy("repository-url-copy", forked Repository.httpUrl, true ){
< div class = "btn-group" data-toggle = "buttons-radio" >
< button class = "btn btn-small active" type = "button" id = "repository-url-http" > HTTP< / button >
@if(settings.ssh & & loginAccount.isDefined){
< button class = "btn btn-small" type = "button" id = "repository-url-ssh" style = "border-radius: 0px;" > SSH< / button >
}
< / div >
< input type = "text" style = "width: 500px;" value = "@forkedRepository.httpUrl" id = "repository-url" readonly >
}
< div >
< p >
< span class = "strong" > Step 1:< / span > From your project repository, check out a new branch and test the changes.
< / p >
@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\ngit pull ${requestRepositoryUrl} ${pullreq.requestBranch}"){ command =>
@defining(s"git checkout -b ${pullreq.requestUserName}-${pullreq.requestBranch} ${pullreq.branch}\n" +
s"git pull ${forkedRepository.httpUrl} ${pullreq.requestBranch}"){ command =>
@helper.html.copy("merge-command-copy-1", command){
< pre style = "width: 5 00px; float: left;" > @command< / pre >
< pre style = "width: 6 00px; float: left; font-size: 12px; border-radius: 3px 0px 3px 3px;" id = "merge-command " > @Html( command) < / pre >
}
}
< / div >
@*
< div >
< p >
< span class = "strong" > Step 2:< / span > Bring in @{pullreq.requestUserName}'s changes and test
< / p >
@defining(s"git pull ${requestRepositoryUrl} ${pullreq.requestBranch}"){ command =>
@helper.html.copy("merge-command-copy-2", command){
< pre style = "width: 500px; float: left;" > @command< / pre >
}
}
< / div >
*@
< div >
< p >
< span class = "strong" > Step 2:< / span > Merge the changes and update on the server.
< / p >
@defining(s"git checkout ${pullreq.branch}\ngit merge --no-ff ${pullreq.requestUserName}-${pullreq.requestBranch}\ngit push origin ${pullreq.branch}"){ command =>
@defining(s"git checkout ${pullreq.branch}\ngit merge --no-ff ${pullreq.requestUserName}-${pullreq.requestBranch}\n" +
s"git push origin ${pullreq.branch}"){ command =>
@helper.html.copy("merge-command-copy-2", command){
< pre style = "width: 5 00px; float: left;" > @command< / pre >
< pre style = "width: 6 00px; float: left; font-size: 12px; border-radius: 3px 0px 3px 3px; " > @command< / pre >
}
}
< / div >
< / div >
< / div >
< 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" >
Merge pull request #@issue.issueId from @{pullreq.requestUserName}/@{pullreq.requestBranch}
< / div >
@@ -151,5 +151,31 @@ $(function(){
$ ( '#merge-pull-request' ) . hide ( ) ;
$ ( '#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 >