mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
cherry pick done
This commit is contained in:
parent
d4946143a8
commit
e021e6fd9b
2 changed files with 23 additions and 2 deletions
|
@ -118,7 +118,8 @@ var Command = Backbone.Model.extend({
|
||||||
log: /^log($|\s)/,
|
log: /^log($|\s)/,
|
||||||
merge: /^merge($|\s)/,
|
merge: /^merge($|\s)/,
|
||||||
show: /^show($|\s)/,
|
show: /^show($|\s)/,
|
||||||
status: /^status($|\s)/
|
status: /^status($|\s)/,
|
||||||
|
'cherry-pick': /^cherry-pick($|\s)/
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -258,6 +259,7 @@ OptionParser.prototype.getMasterOptionMap = function() {
|
||||||
status: {},
|
status: {},
|
||||||
log: {},
|
log: {},
|
||||||
add: {},
|
add: {},
|
||||||
|
'cherry-pick': {},
|
||||||
branch: {
|
branch: {
|
||||||
'-d': false,
|
'-d': false,
|
||||||
'-D': false,
|
'-D': false,
|
||||||
|
|
21
src/git.js
21
src/git.js
|
@ -455,6 +455,24 @@ GitEngine.prototype.reset = function(target) {
|
||||||
this.setTargetLocation('HEAD', this.getCommitFromRef(target));
|
this.setTargetLocation('HEAD', this.getCommitFromRef(target));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.cherrypickStarter = function() {
|
||||||
|
this.validateArgBounds(this.generalArgs, 1, 1);
|
||||||
|
var newCommit = this.cherrypick(this.generalArgs[0]);
|
||||||
|
|
||||||
|
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||||
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.cherrypick = function(ref) {
|
||||||
|
var commit = this.getCommitFromRef(ref);
|
||||||
|
// alter the ID slightly
|
||||||
|
var id = this.rebaseAltID(commit.get('id'));
|
||||||
|
|
||||||
|
// now commit with that id onto HEAD
|
||||||
|
var newCommit = this.makeCommit([this.getCommitFromRef('HEAD')], id);
|
||||||
|
this.setTargetLocation(this.HEAD, newCommit);
|
||||||
|
return newCommit;
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.commitStarter = function() {
|
GitEngine.prototype.commitStarter = function() {
|
||||||
this.acceptNoGeneralArgs();
|
this.acceptNoGeneralArgs();
|
||||||
if (this.commandOptions['-am'] && (
|
if (this.commandOptions['-am'] && (
|
||||||
|
@ -1244,7 +1262,8 @@ GitEngine.prototype.dispatch = function(command, callback) {
|
||||||
|
|
||||||
command.set('status', 'processing');
|
command.set('status', 'processing');
|
||||||
try {
|
try {
|
||||||
this[command.get('method') + 'Starter']();
|
var methodName = command.get('method').replace(/-/g, '') + 'Starter';
|
||||||
|
this[methodName]();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof GitError ||
|
if (err instanceof GitError ||
|
||||||
err instanceof CommandResult) {
|
err instanceof CommandResult) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue