diff --git a/editor/js/ui/diff.js b/editor/js/ui/diff.js index cfec75e75..012005a9d 100644 --- a/editor/js/ui/diff.js +++ b/editor/js/ui/diff.js @@ -1768,7 +1768,7 @@ RED.diff = (function() { // } var actualLineNumber = hunk.diffStart + lineNumber; - var isMergeHeader = isConflict && /^..(<<<<<<<|=======$|>>>>>>>)/.test(lineText); + var isMergeHeader = isConflict && /^\+\+(<<<<<<<|=======$|>>>>>>>)/.test(lineText); var diffRow = $('
Automatic merging of changes failed.
Fix the unmerged conflicts then commit the results.
"; + var options = { + type: 'error', + fixed: true, + id: 'merge-conflict', + buttons: [ + { + text: "Show merge conflicts", + click: function() { + mergeConflictNotification.hideNotification(); + RED.sidebar.versionControl.showLocalChanges(); + } + } + ] + } + mergeConflictNotification = RED.notify(text,options); } sidebarContent.addClass("sidebar-version-control-merging"); unmergedContent.show(); diff --git a/editor/sass/projects.scss b/editor/sass/projects.scss index 64220479d..d9b2545ac 100644 --- a/editor/sass/projects.scss +++ b/editor/sass/projects.scss @@ -501,9 +501,9 @@ top: 4px; right: 4px; display: none; - } - button { - width: 24px; + button { + width: 24px; + } } &:hover { diff --git a/red/runtime/storage/localfilesystem/projects/Project.js b/red/runtime/storage/localfilesystem/projects/Project.js index 4b8aa7210..aaa900448 100644 --- a/red/runtime/storage/localfilesystem/projects/Project.js +++ b/red/runtime/storage/localfilesystem/projects/Project.js @@ -523,11 +523,11 @@ Project.prototype.pull = function (user,remoteBranchName,setRemote) { if (setRemote) { return gitTools.setUpstream(this.path, remoteBranchName).then(function() { self.currentRemote = self.parseRemoteBranch(remoteBranchName).remote; - return gitTools.pull(self.path, null, null, authCache.get(self.name,self.remotes[self.currentRemote].fetch,username)); + return gitTools.pull(self.path, null, null, authCache.get(self.name,self.remotes[self.currentRemote].fetch,username),getGitUser(user)); }) } else { var remote = this.parseRemoteBranch(remoteBranchName); - return gitTools.pull(this.path, remote.remote, remote.branch, authCache.get(this.name,this.remotes[remote.remote||self.currentRemote].fetch,username)); + return gitTools.pull(this.path, remote.remote, remote.branch, authCache.get(this.name,this.remotes[remote.remote||self.currentRemote].fetch,username),getGitUser(user)); } }; diff --git a/red/runtime/storage/localfilesystem/projects/git/index.js b/red/runtime/storage/localfilesystem/projects/git/index.js index c806a17f4..ecb4e3d72 100644 --- a/red/runtime/storage/localfilesystem/projects/git/index.js +++ b/red/runtime/storage/localfilesystem/projects/git/index.js @@ -428,12 +428,20 @@ module.exports = { var args = ["branch","--set-upstream-to",remoteBranch]; return runGitCommand(args,cwd); }, - pull: function(cwd,remote,branch,auth) { + pull: function(cwd,remote,branch,auth,gitUser) { var args = ["pull"]; if (remote && branch) { args.push(remote); args.push(branch); } + if (gitUser && gitUser['name'] && gitUser['email']) { + args.unshift('user.name="'+gitUser['name']+'"'); + args.unshift('-c'); + args.unshift('user.email="'+gitUser['email']+'"'); + args.unshift('-c'); + } + //TODO: only do this if asked for + args.push("--allow-unrelated-histories"); var promise; if (auth) { if ( auth.key_path ) { @@ -556,7 +564,7 @@ module.exports = { return runGitCommand(args,cwd,env); }, getFileDiff(cwd,file,type) { - var args = ["diff"]; + var args = ["diff","-w"]; if (type === "tree") { // nothing else to do } else if (type === "index") { ').appendTo(stagedContent); bg = $('').appendTo(header); + var showCommitBox = function() { + commitMessage.val(""); + submitCommitButton.attr("disabled",true); + unstagedContent.css("height","30px"); + if (unmergedContent.is(":visible")) { + unmergedContent.css("height","30px"); + stagedContent.css("height","calc(100% - 60px - 175px)"); + } else { + stagedContent.css("height","calc(100% - 30px - 175px)"); + } + commitBox.show(); + setTimeout(function() { + commitBox.css("height","175px"); + },10); + stageAllButton.attr("disabled",true); + unstageAllButton.attr("disabled",true); + commitButton.attr("disabled",true); + abortMergeButton.attr("disabled",true); + commitMessage.focus(); + } commitButton = $('') .appendTo(bg) .click(function(evt) { evt.preventDefault(); evt.stopPropagation(); - commitMessage.val(""); - submitCommitButton.attr("disabled",true); - unstagedContent.css("height","30px"); - if (unmergedContent.is(":visible")) { - unmergedContent.css("height","30px"); - stagedContent.css("height","calc(100% - 60px - 175px)"); - } else { - stagedContent.css("height","calc(100% - 30px - 175px)"); - } - commitBox.show(); - setTimeout(function() { - commitBox.css("height","175px"); - },10); - stageAllButton.attr("disabled",true); - unstageAllButton.attr("disabled",true); - commitButton.attr("disabled",true); - commitMessage.focus(); + showCommitBox(); }); unstageAllButton = $('') .appendTo(bg) @@ -467,6 +475,8 @@ RED.sidebar.versionControl = (function() { stageAllButton.attr("disabled",false); unstageAllButton.attr("disabled",false); commitButton.attr("disabled",false); + abortMergeButton.attr("disabled",false); + }) var submitCommitButton = $('') .appendTo(commitToolbar) @@ -1045,16 +1055,6 @@ RED.sidebar.versionControl = (function() { // } // } - function showMergeConflictNotification() { - if (isMerging) { - mergeConflictNotification = RED.notify("NLS: Automatic merging of remote changes failed. Fix the unmerged conflicts then commit the results."+ - '