Skip to content
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c9ac67f
Initial commit to observe merge messages
isc-svelury Nov 9, 2021
39ae70c
Merge now works. Some testing and error handling remains.
isc-svelury Nov 9, 2021
d54a722
Banner for successful merges.
isc-svelury Nov 9, 2021
f6962e3
Fixed output for successful merge
isc-svelury Nov 9, 2021
d15aa7c
Commit to test automatic merge message
isc-svelury Nov 9, 2021
01b8209
logging commit
isc-svelury Nov 9, 2021
67042ae
Fix merge success condition
isc-svelury Nov 9, 2021
8c76d8f
Minor update to merge call
isc-svelury Nov 9, 2021
45550b1
comment to test merge
isc-svelury Nov 9, 2021
a45b754
logging
isc-svelury Nov 9, 2021
bde4373
logging
isc-svelury Nov 9, 2021
ccbbe83
commit to test merge
isc-svelury Nov 9, 2021
8fb40bd
Fixed a bug where when automatic merge is possible, it does not work …
isc-svelury Nov 9, 2021
ce88741
comment to test merge
isc-svelury Nov 9, 2021
8bbf748
comment to test merge
isc-svelury Nov 9, 2021
4df0f0b
Fix success handler for test merge
isc-svelury Nov 10, 2021
f53cad1
Comment to test merge
isc-svelury Nov 10, 2021
bec0e5f
Fix handler for successful merge
isc-svelury Nov 10, 2021
0c6d53b
Comment to test merge
isc-svelury Nov 10, 2021
b3b5e0e
Better logging
isc-svelury Nov 10, 2021
d17c871
Comment to test merge
isc-svelury Nov 10, 2021
7e1221b
Merge branch 'new-branch' into merge-functionality
isc-svelury Nov 10, 2021
35593a0
Comment to test merge
isc-svelury Nov 10, 2021
3f141c5
Merge branch 'new-branch' into merge-functionality
isc-svelury Nov 10, 2021
9600cbd
Commenting for merge conflict
isc-svelury Nov 10, 2021
ba50456
Error handling for cases when git returns the error message as a part…
isc-svelury Nov 10, 2021
fe05e1f
Comment to test merge
isc-svelury Nov 10, 2021
a17c068
comment to test merge conflict
isc-svelury Nov 10, 2021
d5e7d04
comment for merge conflict
isc-svelury Nov 10, 2021
195d0dc
Fixing merge conflict
isc-svelury Nov 10, 2021
372b192
Comment to test merge
isc-svelury Nov 10, 2021
bbd636b
Merge branch 'new-branch' into merge-functionality
isc-svelury Nov 10, 2021
1d6fa3f
Cleanup merging remote branch
isc-svelury Nov 10, 2021
e86100f
comment to test local merge
isc-svelury Nov 10, 2021
bf8280f
comment to test remote merge
isc-svelury Nov 10, 2021
572ec85
Comment to test remote merge conflict
isc-svelury Nov 10, 2021
294a509
Comment to test remote merge conflict
isc-svelury Nov 10, 2021
906505a
Remote merge works as expected
isc-svelury Nov 10, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 80 additions & 5 deletions git-webui/release/share/git-webui/webui/js/git-webui.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ webui.COLORS = ["#ffab1d", "#fd8c25", "#f36e4a", "#fc6148", "#d75ab6", "#b25ade"
"#e47b07", "#e36920", "#d34e2a", "#ec3b24", "#ba3d99", "#9d45c9", "#4f5aec", "#615dcf", "#3286cf", "#00abca", "#279227", "#3a980c", "#6c7f00", "#ab8b0a", "#b56427", "#757575",
"#ff911a", "#fc8120", "#e7623e", "#fa5236", "#ca4da9", "#a74fd3", "#5a68ff", "#6d69db", "#489bd9", "#00bcde", "#36a436", "#47a519", "#798d0a", "#c1a120", "#bf7730", "#8e8e8e"]

webui.showSuccess = function(message) {
var messageBox = $("#message-box");
messageBox.empty();
$( '<div class="alert alert-success alert-dismissible" role="alert">' +
'<button type="button" class="btn btn-default close" data-dismiss="alert">' +
'<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">'+
'<path fill-rule="evenodd" clip-rule="evenodd" d="M13.854 2.146a.5.5 0 0 1 0 .708l-11 11a.5.5 0 0 1-.708-.708l11-11a.5.5 0 0 1 .708 0Z" fill="#000"/>'+
'<path fill-rule="evenodd" clip-rule="evenodd" d="M2.146 2.146a.5.5 0 0 0 0 .708l11 11a.5.5 0 0 0 .708-.708l-11-11a.5.5 0 0 0-.708 0Z" fill="#000"/>'+
'</svg>'+
'</button>' +
message +
'</div>').appendTo(messageBox);
}

webui.showError = function(message) {
$("#error-modal .alert").text(message);
Expand Down Expand Up @@ -122,10 +135,21 @@ webui.git = function(cmd, arg1, arg2, arg3, arg4) {
}
}
} else {
if(errorCallback) {
errorCallback(message);
} else{
webui.showError(message);
var displayMessage = ""
if(output.length > 0){
displayMessage += (output+"\n");
}
if(message.length > 0){
displayMessage += message;
}
if(displayMessage.length > 0){
if(errorCallback) {
errorCallback(displayMessage);
} else{
webui.showError(displayMessage);
}
} else {
webui.showError("The command <pre>"+cmd+"</pre> failed because of an unknown reason. Returned response: \n\n"+data)
}
}
} else {
Expand Down Expand Up @@ -289,6 +313,7 @@ webui.SideBarView = function(mainView) {
var cardBody = $('<div class="card-body">' +
'<div class="d-grid gap-2 col-12 mx-auto">'+
'<button class="btn btn-xs btn-primary btn-block btn-checkout-local-branch mt-1">Checkout Branch</button>'+
'<button class="btn btn-xs btn-warning btn-block btn-merge-branch">Merge Branch</button>'+
'<button class="btn btn-xs btn-danger btn-block btn-delete-branch">Delete Branch</button>'+
'</div>'+
'</div>').appendTo(collapseDiv);
Expand All @@ -315,6 +340,7 @@ webui.SideBarView = function(mainView) {
var cardBody = $('<div class="card-body">' +
'<div class="d-grid gap-2 col-12 mx-auto">'+
'<button class="btn btn-xs btn-primary btn-block btn-checkout-remote-branch">Checkout Branch</button>'+
'<button class="btn btn-xs btn-warning btn-block btn-merge-remote-branch">Merge Branch</button>'+
'</div>'+
'</div>').appendTo(collapseDiv);
}
Expand Down Expand Up @@ -1953,6 +1979,55 @@ $(function () {

});

$(document).on('click', '.btn-merge-branch', function(e){
e.preventDefault();
var refName = $(this).parent().parent().parent().siblings(
".card-header").children("button").html();

function testMergeHandler (message) {
function suppressErrorMessage(error) {
}
webui.git("merge --abort", "", "", suppressErrorMessage);

if(message.includes("Automatic merge went well") || message.includes("Auto-merging ")){
webui.git("merge "+refName, function (output){
webui.showSuccess(output);
});
}
else {
webui.showError(message);
}
}
webui.git("merge --no-commit --no-ff "+refName, "", "", testMergeHandler, testMergeHandler);
});

$(document).on('click', '.btn-merge-remote-branch', function(e){
e.preventDefault();
var refName = $(this).parent().parent().parent().siblings(
".card-header").children("button").html();

var remoteName = refName.split('/')[0];
var branchName = refName.split('/')[1];

webui.git("fetch "+remoteName+" "+branchName);

function testMergeHandler (message) {
function suppressErrorMessage(error) {
}
webui.git("merge --abort", "", "", suppressErrorMessage);

if(message.includes("Automatic merge went well") || message.includes("Auto-merging ")){
webui.git("merge "+refName, function (output){
webui.showSuccess(output);
});
}
else {
webui.showError(message);
}
}
webui.git("merge --no-commit --no-ff "+refName, "", "", testMergeHandler, testMergeHandler);
});

$(document).on('click', '.btn-checkout-remote-branch', function(e) {
e.preventDefault();
var refName = $(this).parent().parent().parent().siblings(
Expand All @@ -1961,7 +2036,7 @@ $(function () {
var remoteName = refName.split('/')[0];
var branchName = refName.split('/')[1];

webui.git("fetch "+remoteName);
webui.git("fetch "+remoteName+" "+branchName);
webui.git("checkout -b " +branchName + " " + refName, function() {
updateSideBar();
});
Expand Down