mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Handle overwrite warning on local branch change
This commit is contained in:
parent
1b632894d3
commit
91352e855a
@ -604,6 +604,13 @@ RED.sidebar.versionControl = (function() {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
400: {
|
400: {
|
||||||
|
'git_local_overwrite': function(error) {
|
||||||
|
spinner.remove();
|
||||||
|
RED.notify("You have local changes that would be overwritten by changing the branch. You must either commit or undo those changes first.",{
|
||||||
|
type:'error',
|
||||||
|
timeout: 8000
|
||||||
|
});
|
||||||
|
},
|
||||||
'unexpected_error': function(error) {
|
'unexpected_error': function(error) {
|
||||||
spinner.remove();
|
spinner.remove();
|
||||||
console.log(error);
|
console.log(error);
|
||||||
@ -612,7 +619,6 @@ RED.sidebar.versionControl = (function() {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},body).always(function(){
|
},body).always(function(){
|
||||||
console.log("switch deployinflight to false")
|
|
||||||
RED.deploy.setDeployInflight(false);
|
RED.deploy.setDeployInflight(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -823,7 +829,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
closeRemoteBox();
|
closeRemoteBox();
|
||||||
},
|
},
|
||||||
400: {
|
400: {
|
||||||
'git_pull_overwrite': function(err) {
|
'git_local_overwrite': function(err) {
|
||||||
RED.notify("Unable to pull remote changes; your unstaged local changes would be overwritten. Commit your changes and try again."+
|
RED.notify("Unable to pull remote changes; your unstaged local changes would be overwritten. Commit your changes and try again."+
|
||||||
'<p><a href="#" onclick="RED.sidebar.versionControl.showLocalChanges(); return false;">'+'Show unstaged changes'+'</a></p>',"error",false,10000000);
|
'<p><a href="#" onclick="RED.sidebar.versionControl.showLocalChanges(); return false;">'+'Show unstaged changes'+'</a></p>',"error",false,10000000);
|
||||||
},
|
},
|
||||||
|
@ -24,19 +24,6 @@ var path = require("path");
|
|||||||
var gitCommand = "git";
|
var gitCommand = "git";
|
||||||
var log;
|
var log;
|
||||||
|
|
||||||
// function execCommand(command,args,cwd) {
|
|
||||||
// return when.promise(function(resolve,reject) {
|
|
||||||
// var fullCommand = command+" "+args.join(" ");
|
|
||||||
// child = exec(fullCommand, {cwd: cwd, timeout:3000, killSignal: 'SIGTERM'}, function (error, stdout, stderr) {
|
|
||||||
// if (error) {
|
|
||||||
// reject(error);
|
|
||||||
// } else {
|
|
||||||
// resolve(stdout);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
function runGitCommand(args,cwd,env) {
|
function runGitCommand(args,cwd,env) {
|
||||||
log.trace(gitCommand + JSON.stringify(args));
|
log.trace(gitCommand + JSON.stringify(args));
|
||||||
return when.promise(function(resolve,reject) {
|
return when.promise(function(resolve,reject) {
|
||||||
@ -64,9 +51,14 @@ function runGitCommand(args,cwd,env) {
|
|||||||
err.code = "git_auth_failed";
|
err.code = "git_auth_failed";
|
||||||
} else if(/Connection refused/.test(stderr)) {
|
} else if(/Connection refused/.test(stderr)) {
|
||||||
err.code = "git_connection_failed";
|
err.code = "git_connection_failed";
|
||||||
} else {
|
} else if (/commit your changes or stash/.test(stderr)) {
|
||||||
err.code = "git_error";
|
err.code = "git_local_overwrite";
|
||||||
|
} else if (/CONFLICT/.test(err.stdout)) {
|
||||||
|
err.code = "git_pull_merge_conflict";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
resolve(stdout);
|
resolve(stdout);
|
||||||
|
Loading…
Reference in New Issue
Block a user