mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-07 20:07:30 +02:00
Merge branch 'master' into pr-add-release
This commit is contained in:
@@ -1 +1 @@
|
||||
sbt.version=1.0.4
|
||||
sbt.version=1.1.0
|
||||
|
||||
@@ -4,7 +4,7 @@ import gitbucket.core.model.Account
|
||||
import gitbucket.core.util.Directory._
|
||||
import gitbucket.core.util.SyntaxSugars._
|
||||
import org.eclipse.jgit.merge.{MergeStrategy, Merger, RecursiveMerger}
|
||||
import org.eclipse.jgit.api.{Git, MergeResult}
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.transport.RefSpec
|
||||
import org.eclipse.jgit.errors.NoMergeBaseException
|
||||
import org.eclipse.jgit.lib.{CommitBuilder, ObjectId, PersonIdent, Repository}
|
||||
@@ -211,7 +211,7 @@ object MergeService{
|
||||
}
|
||||
|
||||
// update branch from cache
|
||||
def merge(message:String, committer:PersonIdent) = {
|
||||
def merge(message: String, committer: PersonIdent) = {
|
||||
if(checkConflict().isDefined){
|
||||
throw new RuntimeException("This pull request can't merge automatically.")
|
||||
}
|
||||
@@ -229,12 +229,13 @@ object MergeService{
|
||||
throw new RuntimeException("This pull request can't merge automatically.")
|
||||
}
|
||||
|
||||
def _cloneCommit(commit: RevCommit, parents: Array[ObjectId]): CommitBuilder = {
|
||||
def _cloneCommit(commit: RevCommit, parentId: ObjectId, baseId: ObjectId): CommitBuilder = {
|
||||
val merger = MergeStrategy.RECURSIVE.newMerger(repository, true)
|
||||
merger.merge(commit.toObjectId, baseId)
|
||||
|
||||
val newCommit = new CommitBuilder()
|
||||
newCommit.setTreeId(commit.getTree.getId)
|
||||
parents.foreach { parentId =>
|
||||
newCommit.addParentId(parentId)
|
||||
}
|
||||
newCommit.setTreeId(merger.getResultTreeId)
|
||||
newCommit.addParentId(parentId)
|
||||
newCommit.setAuthor(commit.getAuthorIdent)
|
||||
newCommit.setCommitter(committer)
|
||||
newCommit.setMessage(commit.getFullMessage)
|
||||
@@ -246,7 +247,7 @@ object MergeService{
|
||||
|
||||
using(repository.newObjectInserter){ inserter =>
|
||||
commits.foreach { commit =>
|
||||
val nextCommit = _cloneCommit(commit, Array(previousId))
|
||||
val nextCommit = _cloneCommit(commit, previousId, mergeBaseTipCommit.getId)
|
||||
previousId = inserter.insert(nextCommit)
|
||||
}
|
||||
inserter.flush()
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
</div>
|
||||
<div style="padding-left: 10px; padding-right: 10px;">
|
||||
@account.description.map{ description =>
|
||||
<p>@description</p>
|
||||
<p style="color: #999">@description</p>
|
||||
}
|
||||
@if(account.url.isDefined){
|
||||
<p style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
<i class="octicon octicon-home"></i> <a href="@account.url">@account.url</a>
|
||||
</p>
|
||||
}
|
||||
<p>
|
||||
<p style="color: #999">
|
||||
<i class="octicon octicon-clock"></i> Joined on @helpers.date(account.registeredDate)
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
<div id="editor" style="width: 100%; height: 300px;"></div>
|
||||
<div class="block">
|
||||
<input type="button" value="Run query" id="run-query" class="btn btn-success">
|
||||
<input type="button" value="Clear" id="clear-query" class="btn btn-default">
|
||||
</div>
|
||||
<div id="result"></div>
|
||||
</div>
|
||||
@@ -40,50 +41,55 @@ $(function(){
|
||||
editor.setTheme("ace/theme/monokai");
|
||||
editor.getSession().setMode("ace/mode/sql");
|
||||
|
||||
|
||||
$('#table-tree').jstree();
|
||||
|
||||
$('.table-link').click(function(e){
|
||||
var query = editor.getValue();
|
||||
if(query != ''){
|
||||
query = query + '\n';
|
||||
if(editor.getValue().trim() == ''){
|
||||
editor.getSession().insert(editor.getCursorPosition(), 'SELECT * FROM ' + $(e.target).text());
|
||||
} else {
|
||||
editor.getSession().insert(editor.getCursorPosition(), $(e.target).text());
|
||||
}
|
||||
console.log(e);
|
||||
editor.setValue(query + 'SELECT * FROM ' + $(e.target).text());
|
||||
editor.focus();
|
||||
});
|
||||
|
||||
$('#clear-query').click(function(){
|
||||
editor.setValue('');
|
||||
});
|
||||
|
||||
$('#run-query').click(function(){
|
||||
console.log(editor.getValue());
|
||||
$.post('@context.path/admin/dbviewer/_query', { query: editor.getValue() }, function(data){
|
||||
if(data.type == "query"){
|
||||
var table = $('<table class="table table-bordered table-hover table-scroll">');
|
||||
var selectedText = editor.getSession().doc.getTextRange(editor.selection.getRange()).trim();
|
||||
|
||||
var header = $('<tr>');
|
||||
$.each(data.columns, function(i, column){
|
||||
header.append($('<th>').text(column));
|
||||
});
|
||||
table.append($('<thead>').append(header));
|
||||
$.post('@context.path/admin/dbviewer/_query', { query: selectedText == '' ? editor.getValue() : selectedText },
|
||||
function(data){
|
||||
if(data.type == "query"){
|
||||
var table = $('<table class="table table-bordered table-hover table-scroll">');
|
||||
|
||||
var body = $('<tbody>');
|
||||
$.each(data.rows, function(i, rs){
|
||||
var row = $('<tr>');
|
||||
var header = $('<tr>');
|
||||
$.each(data.columns, function(i, column){
|
||||
row.append($('<td>').text(rs[column]));
|
||||
header.append($('<th>').text(column));
|
||||
});
|
||||
body.append(row);
|
||||
});
|
||||
table.append($('<thead>').append(header));
|
||||
|
||||
table.append(body);
|
||||
$('#result').empty().append(table);
|
||||
var body = $('<tbody>');
|
||||
$.each(data.rows, function(i, rs){
|
||||
var row = $('<tr>');
|
||||
$.each(data.columns, function(i, column){
|
||||
row.append($('<td>').text(rs[column]));
|
||||
});
|
||||
body.append(row);
|
||||
});
|
||||
|
||||
} else if(data.type == "update"){
|
||||
$('#result').empty().append($('<span>').text('Updated ' + data.rows + ' rows.'));
|
||||
table.append(body);
|
||||
$('#result').empty().append(table);
|
||||
|
||||
} else if(data.type == "error"){
|
||||
$('#result').empty().append($('<span class="error">').text(data.message));
|
||||
} else if(data.type == "update"){
|
||||
$('#result').empty().append($('<span>').text('Updated ' + data.rows + ' rows.'));
|
||||
|
||||
} else if(data.type == "error"){
|
||||
$('#result').empty().append($('<span class="error">').text(data.message));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -22,12 +22,24 @@
|
||||
elastic = true,
|
||||
tabIndex = 1
|
||||
)
|
||||
<div class="text-right">
|
||||
<input type="hidden" name="issueId" value="@issue.issueId"/>
|
||||
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
|
||||
<input type="submit" class="btn btn-default" tabindex="3" formaction="@helpers.url(repository)/issue_comments/state" value="@{if(issue.closed) "Reopen" else "Close"}" id="action"/>
|
||||
}
|
||||
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
|
||||
<div class="text-right">
|
||||
<input type="hidden" name="issueId" value="@issue.issueId"/>
|
||||
@if((reopenable || !issue.closed) && (isManageable || issue.openedUserName == context.loginAccount.get.userName)){
|
||||
<input type="hidden" id="action" name="action" value="comment"/>
|
||||
<div class="btn-group dropup">
|
||||
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment" id="submit-button"/>
|
||||
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-right">
|
||||
<li><a id="menu-comment">Comment</a></li>
|
||||
<li><a id="menu-x-and-comment">@{if(issue.closed) "Reopen" else "Close"} and comment</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
} else {
|
||||
<input type="submit" class="btn btn-success" tabindex="2" formaction="@helpers.url(repository)/issue_comments/new" value="Comment"/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,8 +47,13 @@
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('#action').click(function(){
|
||||
$('<input type="hidden">').attr('name', 'action').val($(this).val().toLowerCase()).appendTo('form');
|
||||
$('#menu-comment').click(function(){
|
||||
$('#submit-button').attr('value', 'Comment').attr('formaction', '@helpers.url(repository)/issue_comments/new');
|
||||
$('#action').val('comment');
|
||||
});
|
||||
$('#menu-x-and-comment').click(function(){
|
||||
$('#submit-button').attr('value', '@{if(issue.closed) "Reopen" else "Close"} and comment').attr('formaction', '@helpers.url(repository)/issue_comments/state');
|
||||
$('#action').val('@{if(issue.closed) "reopen" else "close"}');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user