mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-08-04 18:15:22 +02:00
[Origin] Some origin work around remote branches
This commit is contained in:
parent
6080d324ce
commit
a24f62420d
8 changed files with 139 additions and 27 deletions
|
@ -5401,6 +5401,10 @@ require.define("/src/js/intl/strings.js",function(require,module,exports,__dirna
|
|||
'en_US': 'Quick commit. Go Bears!',
|
||||
'zh_CN': '快速提交。上啊月熊!'
|
||||
},
|
||||
'git-error-remote-branch': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'You cannot execute that command on a remote branch'
|
||||
},
|
||||
'git-error-origin-required': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'An origin is required for that command'
|
||||
|
@ -7502,12 +7506,27 @@ GitEngine.prototype.getBranches = function() {
|
|||
id: branch.get('id'),
|
||||
selected: this.HEAD.get('target') === branch,
|
||||
target: branch.get('target'),
|
||||
remote: branch.getIsRemote(),
|
||||
obj: branch
|
||||
});
|
||||
}, this);
|
||||
return toReturn;
|
||||
};
|
||||
|
||||
GitEngine.prototype.getRemoteBranches = function() {
|
||||
var all = this.getBranches();
|
||||
return _.filter(all, function(branchJSON) {
|
||||
return branchJSON.remote === true;
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.getLocalBranches = function() {
|
||||
var all = this.getBranches();
|
||||
return _.filter(all, function(branchJSON) {
|
||||
return branchJSON.remote === false;
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.printBranchesWithout = function(without) {
|
||||
var commitToBranches = this.getUpstreamBranchSet();
|
||||
var commitID = this.getCommitFromRef(without).get('id');
|
||||
|
@ -7783,7 +7802,7 @@ GitEngine.prototype.fetchStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.fetch = function() {
|
||||
// TODO refactor to use rebase animation stuff!!
|
||||
// TODO refactor to use rebase animation stuff!!!!
|
||||
// ok so we essentially are always in "-force" mode, since we always assume
|
||||
// the origin commits are downstream of where we are. Here is the outline:
|
||||
//
|
||||
|
@ -8624,7 +8643,15 @@ GitEngine.prototype.branchStarter = function() {
|
|||
|
||||
|
||||
if (this.generalArgs.length === 0) {
|
||||
this.printBranches(this.getBranches());
|
||||
var branches;
|
||||
if (this.commandOptions['-a']) {
|
||||
branches = this.getBranches();
|
||||
} else if (this.commandOptions['-r']) {
|
||||
branches = this.getRemoteBranches();
|
||||
} else {
|
||||
branches = this.getLocalBranches();
|
||||
}
|
||||
this.printBranches(branches);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8633,12 +8660,19 @@ GitEngine.prototype.branchStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.forceBranch = function(branchName, where) {
|
||||
branchName = this.crappyUnescape(branchName);
|
||||
// if branchname doesn't exist...
|
||||
if (!this.refs[branchName]) {
|
||||
this.branch(branchName, where);
|
||||
}
|
||||
|
||||
var branch = this.resolveID(branchName);
|
||||
if (branch.getIsRemote()) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-remote-branch')
|
||||
});
|
||||
}
|
||||
|
||||
if (branch.get('type') !== 'branch') {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-options')
|
||||
|
@ -8662,7 +8696,6 @@ GitEngine.prototype.deleteBranch = function(name) {
|
|||
if (target.get('type') !== 'branch' ||
|
||||
target.get('id') == 'master' ||
|
||||
this.HEAD.get('target') === target) {
|
||||
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-branch')
|
||||
});
|
||||
|
@ -8670,6 +8703,12 @@ GitEngine.prototype.deleteBranch = function(name) {
|
|||
|
||||
// now we know it's a branch
|
||||
var branch = target;
|
||||
// if its remote
|
||||
if (target.getIsRemote()) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-remote-branch')
|
||||
});
|
||||
}
|
||||
|
||||
this.branchCollection.remove(branch);
|
||||
this.refs[branch.get('id')] = undefined;
|
||||
|
@ -13416,6 +13455,8 @@ GitOptionParser.prototype.getMasterOptionMap = function() {
|
|||
'-d': false,
|
||||
'-D': false,
|
||||
'-f': false,
|
||||
'-a': false,
|
||||
'-r': false,
|
||||
'--contains': false
|
||||
},
|
||||
checkout: {
|
||||
|
@ -22579,6 +22620,8 @@ GitOptionParser.prototype.getMasterOptionMap = function() {
|
|||
'-d': false,
|
||||
'-D': false,
|
||||
'-f': false,
|
||||
'-a': false,
|
||||
'-r': false,
|
||||
'--contains': false
|
||||
},
|
||||
checkout: {
|
||||
|
@ -23247,12 +23290,27 @@ GitEngine.prototype.getBranches = function() {
|
|||
id: branch.get('id'),
|
||||
selected: this.HEAD.get('target') === branch,
|
||||
target: branch.get('target'),
|
||||
remote: branch.getIsRemote(),
|
||||
obj: branch
|
||||
});
|
||||
}, this);
|
||||
return toReturn;
|
||||
};
|
||||
|
||||
GitEngine.prototype.getRemoteBranches = function() {
|
||||
var all = this.getBranches();
|
||||
return _.filter(all, function(branchJSON) {
|
||||
return branchJSON.remote === true;
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.getLocalBranches = function() {
|
||||
var all = this.getBranches();
|
||||
return _.filter(all, function(branchJSON) {
|
||||
return branchJSON.remote === false;
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.printBranchesWithout = function(without) {
|
||||
var commitToBranches = this.getUpstreamBranchSet();
|
||||
var commitID = this.getCommitFromRef(without).get('id');
|
||||
|
@ -23528,7 +23586,7 @@ GitEngine.prototype.fetchStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.fetch = function() {
|
||||
// TODO refactor to use rebase animation stuff!!
|
||||
// TODO refactor to use rebase animation stuff!!!!
|
||||
// ok so we essentially are always in "-force" mode, since we always assume
|
||||
// the origin commits are downstream of where we are. Here is the outline:
|
||||
//
|
||||
|
@ -24369,7 +24427,15 @@ GitEngine.prototype.branchStarter = function() {
|
|||
|
||||
|
||||
if (this.generalArgs.length === 0) {
|
||||
this.printBranches(this.getBranches());
|
||||
var branches;
|
||||
if (this.commandOptions['-a']) {
|
||||
branches = this.getBranches();
|
||||
} else if (this.commandOptions['-r']) {
|
||||
branches = this.getRemoteBranches();
|
||||
} else {
|
||||
branches = this.getLocalBranches();
|
||||
}
|
||||
this.printBranches(branches);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -24378,12 +24444,19 @@ GitEngine.prototype.branchStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.forceBranch = function(branchName, where) {
|
||||
branchName = this.crappyUnescape(branchName);
|
||||
// if branchname doesn't exist...
|
||||
if (!this.refs[branchName]) {
|
||||
this.branch(branchName, where);
|
||||
}
|
||||
|
||||
var branch = this.resolveID(branchName);
|
||||
if (branch.getIsRemote()) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-remote-branch')
|
||||
});
|
||||
}
|
||||
|
||||
if (branch.get('type') !== 'branch') {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-options')
|
||||
|
@ -24407,7 +24480,6 @@ GitEngine.prototype.deleteBranch = function(name) {
|
|||
if (target.get('type') !== 'branch' ||
|
||||
target.get('id') == 'master' ||
|
||||
this.HEAD.get('target') === target) {
|
||||
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-branch')
|
||||
});
|
||||
|
@ -24415,6 +24487,12 @@ GitEngine.prototype.deleteBranch = function(name) {
|
|||
|
||||
// now we know it's a branch
|
||||
var branch = target;
|
||||
// if its remote
|
||||
if (target.getIsRemote()) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-remote-branch')
|
||||
});
|
||||
}
|
||||
|
||||
this.branchCollection.remove(branch);
|
||||
this.refs[branch.get('id')] = undefined;
|
||||
|
@ -25331,6 +25409,10 @@ require.define("/src/js/intl/strings.js",function(require,module,exports,__dirna
|
|||
'en_US': 'Quick commit. Go Bears!',
|
||||
'zh_CN': '快速提交。上啊月熊!'
|
||||
},
|
||||
'git-error-remote-branch': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'You cannot execute that command on a remote branch'
|
||||
},
|
||||
'git-error-origin-required': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'An origin is required for that command'
|
||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue