mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Handle a local branch that does not yet track a remote
This commit is contained in:
parent
94eeaeb8d3
commit
a7e14f1093
@ -883,7 +883,16 @@ RED.projects = (function() {
|
|||||||
} else {
|
} else {
|
||||||
branchPrefix = "";
|
branchPrefix = "";
|
||||||
}
|
}
|
||||||
$.getJSON(url,function(result) {
|
|
||||||
|
|
||||||
|
sendRequest({
|
||||||
|
url: url,
|
||||||
|
type: "GET",
|
||||||
|
responses: {
|
||||||
|
0: function(error) {
|
||||||
|
console.log(error);
|
||||||
|
},
|
||||||
|
200: function(result) {
|
||||||
branches = result.branches;
|
branches = result.branches;
|
||||||
result.branches.forEach(function(b) {
|
result.branches.forEach(function(b) {
|
||||||
branchList.editableList('addItem',b);
|
branchList.editableList('addItem',b);
|
||||||
@ -892,7 +901,14 @@ RED.projects = (function() {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
spinner.remove();
|
spinner.remove();
|
||||||
},Math.max(300-(Date.now() - start),0));
|
},Math.max(300-(Date.now() - start),0));
|
||||||
});
|
},
|
||||||
|
400: {
|
||||||
|
'unexpected_error': function(error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
addItem: function(data) { branchList.editableList('addItem',data) },
|
addItem: function(data) { branchList.editableList('addItem',data) },
|
||||||
filter: function() { branchList.editableList('filter') },
|
filter: function() { branchList.editableList('filter') },
|
||||||
|
@ -345,6 +345,7 @@ Project.prototype.status = function() {
|
|||||||
var fetchPromise;
|
var fetchPromise;
|
||||||
if (this.remotes) {
|
if (this.remotes) {
|
||||||
fetchPromise = gitTools.getRemoteBranch(self.path).then(function(remoteBranch) {
|
fetchPromise = gitTools.getRemoteBranch(self.path).then(function(remoteBranch) {
|
||||||
|
if (remoteBranch) {
|
||||||
var allRemotes = Object.keys(self.remotes);
|
var allRemotes = Object.keys(self.remotes);
|
||||||
var match = "";
|
var match = "";
|
||||||
allRemotes.forEach(function(remote) {
|
allRemotes.forEach(function(remote) {
|
||||||
@ -353,6 +354,7 @@ Project.prototype.status = function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return self.fetch(match);
|
return self.fetch(match);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
fetchPromise = when.resolve();
|
fetchPromise = when.resolve();
|
||||||
@ -390,7 +392,7 @@ Project.prototype.status = function() {
|
|||||||
|
|
||||||
Project.prototype.push = function (remoteBranchName,setRemote) {
|
Project.prototype.push = function (remoteBranchName,setRemote) {
|
||||||
var remote = this.parseRemoteBranch(remoteBranchName);
|
var remote = this.parseRemoteBranch(remoteBranchName);
|
||||||
return gitTools.push(this.path, remote.remote || this.currentRemote,remote.branch, setRemote, authCache.get(this.name,this.remotes[this.currentRemote].fetch));
|
return gitTools.push(this.path, remote.remote || this.currentRemote,remote.branch, setRemote, authCache.get(this.name,this.remotes[remote.remote || this.currentRemote].fetch));
|
||||||
};
|
};
|
||||||
|
|
||||||
Project.prototype.pull = function (remoteBranchName,setRemote) {
|
Project.prototype.pull = function (remoteBranchName,setRemote) {
|
||||||
|
@ -489,7 +489,12 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
getRemotes: getRemotes,
|
getRemotes: getRemotes,
|
||||||
getRemoteBranch: function(cwd) {
|
getRemoteBranch: function(cwd) {
|
||||||
return runGitCommand(['rev-parse','--abbrev-ref','--symbolic-full-name','@{u}'],cwd)
|
return runGitCommand(['rev-parse','--abbrev-ref','--symbolic-full-name','@{u}'],cwd).catch(function(err) {
|
||||||
|
if (/no upstream configured for branch/.test(err.message)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
getBranches: getBranches,
|
getBranches: getBranches,
|
||||||
getBranchInfo: getBranchInfo,
|
getBranchInfo: getBranchInfo,
|
||||||
|
Loading…
Reference in New Issue
Block a user