mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
Now can cherry pick multiple commits in a row like git usage Issue #57
This commit is contained in:
parent
3523d28416
commit
80a540e172
7 changed files with 133 additions and 36 deletions
|
@ -94,4 +94,5 @@ Or reported an issue that was successfully closed!
|
|||
* "MaPePeR"
|
||||
* Lutz ("mobilutz")
|
||||
* Jan Philipp
|
||||
* Jon Frisby
|
||||
|
||||
|
|
108
build/bundle.js
108
build/bundle.js
|
@ -8424,22 +8424,53 @@ GitEngine.prototype.reset = function(target) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.cherrypickStarter = function() {
|
||||
this.validateArgBounds(this.generalArgs, 1, 1);
|
||||
var newCommit = this.cherrypick(this.generalArgs[0]);
|
||||
this.validateArgBounds(this.generalArgs, 1, Number.MAX_VALUE);
|
||||
|
||||
this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
// first resolve all the refs (as an error check)
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var commit = this.resolveID(arg);
|
||||
// and check that its not upstream
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: 'The commit ' + commit.get('id') +
|
||||
' already exists in your changes set, aborting!'
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
// error checks are all good, lets go!
|
||||
|
||||
// hack up the rebase response to animate this better
|
||||
var animationResponse = {};
|
||||
animationResponse.destinationBranch = this.resolveID('HEAD');
|
||||
animationResponse.toRebaseArray = [];
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
// now lets start going through
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
var newCommit;
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var oldCommit = this.resolveID(arg);
|
||||
animationResponse.toRebaseArray.push(oldCommit);
|
||||
|
||||
newCommit = this.cherrypick(arg);
|
||||
|
||||
afterSnapshot = this.gitVisuals.genSnapshot();
|
||||
animationResponse.rebaseSteps.push({
|
||||
oldCommit: oldCommit,
|
||||
newCommit: newCommit,
|
||||
beforeSnapshot: beforeSnapshot,
|
||||
afterSnapshot: this.gitVisuals.genSnapshot()
|
||||
});
|
||||
beforeSnapshot = afterSnapshot;
|
||||
}, this);
|
||||
|
||||
this.animationFactory.rebaseAnimation(this.animationQueue, animationResponse, this, this.gitVisuals);
|
||||
};
|
||||
|
||||
GitEngine.prototype.cherrypick = function(ref) {
|
||||
var commit = this.getCommitFromRef(ref);
|
||||
// check if we already have that
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: "We already have that commit in our changes history! You can't cherry-pick it " +
|
||||
"if it shows up in git log."
|
||||
});
|
||||
}
|
||||
|
||||
// alter the ID slightly
|
||||
var id = this.rebaseAltID(commit.get('id'));
|
||||
|
@ -8447,6 +8478,7 @@ GitEngine.prototype.cherrypick = function(ref) {
|
|||
// now commit with that id onto HEAD
|
||||
var newCommit = this.makeCommit([this.getCommitFromRef('HEAD')], id);
|
||||
this.setTargetLocation(this.HEAD, newCommit);
|
||||
|
||||
return newCommit;
|
||||
};
|
||||
|
||||
|
@ -21379,22 +21411,53 @@ GitEngine.prototype.reset = function(target) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.cherrypickStarter = function() {
|
||||
this.validateArgBounds(this.generalArgs, 1, 1);
|
||||
var newCommit = this.cherrypick(this.generalArgs[0]);
|
||||
this.validateArgBounds(this.generalArgs, 1, Number.MAX_VALUE);
|
||||
|
||||
this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
// first resolve all the refs (as an error check)
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var commit = this.resolveID(arg);
|
||||
// and check that its not upstream
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: 'The commit ' + commit.get('id') +
|
||||
' already exists in your changes set, aborting!'
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
// error checks are all good, lets go!
|
||||
|
||||
// hack up the rebase response to animate this better
|
||||
var animationResponse = {};
|
||||
animationResponse.destinationBranch = this.resolveID('HEAD');
|
||||
animationResponse.toRebaseArray = [];
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
// now lets start going through
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
var newCommit;
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var oldCommit = this.resolveID(arg);
|
||||
animationResponse.toRebaseArray.push(oldCommit);
|
||||
|
||||
newCommit = this.cherrypick(arg);
|
||||
|
||||
afterSnapshot = this.gitVisuals.genSnapshot();
|
||||
animationResponse.rebaseSteps.push({
|
||||
oldCommit: oldCommit,
|
||||
newCommit: newCommit,
|
||||
beforeSnapshot: beforeSnapshot,
|
||||
afterSnapshot: this.gitVisuals.genSnapshot()
|
||||
});
|
||||
beforeSnapshot = afterSnapshot;
|
||||
}, this);
|
||||
|
||||
this.animationFactory.rebaseAnimation(this.animationQueue, animationResponse, this, this.gitVisuals);
|
||||
};
|
||||
|
||||
GitEngine.prototype.cherrypick = function(ref) {
|
||||
var commit = this.getCommitFromRef(ref);
|
||||
// check if we already have that
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: "We already have that commit in our changes history! You can't cherry-pick it " +
|
||||
"if it shows up in git log."
|
||||
});
|
||||
}
|
||||
|
||||
// alter the ID slightly
|
||||
var id = this.rebaseAltID(commit.get('id'));
|
||||
|
@ -21402,6 +21465,7 @@ GitEngine.prototype.cherrypick = function(ref) {
|
|||
// now commit with that id onto HEAD
|
||||
var newCommit = this.makeCommit([this.getCommitFromRef('HEAD')], id);
|
||||
this.setTargetLocation(this.HEAD, newCommit);
|
||||
|
||||
return newCommit;
|
||||
};
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.90526ef9.js
Normal file
1
build/bundle.min.90526ef9.js
Normal file
File diff suppressed because one or more lines are too long
2
build/bundle.min.js
vendored
2
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -412,7 +412,7 @@
|
|||
For a much easier time perusing the source, see the individual files at:
|
||||
https://github.com/pcottle/learnGitBranching
|
||||
-->
|
||||
<script src="build/bundle.min.01944793.js"></script>
|
||||
<script src="build/bundle.min.90526ef9.js"></script>
|
||||
|
||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||
The downside? No raw logs to parse for analytics, so I have to include
|
||||
|
|
|
@ -522,22 +522,53 @@ GitEngine.prototype.reset = function(target) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.cherrypickStarter = function() {
|
||||
this.validateArgBounds(this.generalArgs, 1, 1);
|
||||
var newCommit = this.cherrypick(this.generalArgs[0]);
|
||||
this.validateArgBounds(this.generalArgs, 1, Number.MAX_VALUE);
|
||||
|
||||
this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
// first resolve all the refs (as an error check)
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var commit = this.resolveID(arg);
|
||||
// and check that its not upstream
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: 'The commit ' + commit.get('id') +
|
||||
' already exists in your changes set, aborting!'
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
// error checks are all good, lets go!
|
||||
|
||||
// hack up the rebase response to animate this better
|
||||
var animationResponse = {};
|
||||
animationResponse.destinationBranch = this.resolveID('HEAD');
|
||||
animationResponse.toRebaseArray = [];
|
||||
animationResponse.rebaseSteps = [];
|
||||
|
||||
// now lets start going through
|
||||
var beforeSnapshot = this.gitVisuals.genSnapshot();
|
||||
var afterSnapshot;
|
||||
var newCommit;
|
||||
_.each(this.generalArgs, function(arg) {
|
||||
var oldCommit = this.resolveID(arg);
|
||||
animationResponse.toRebaseArray.push(oldCommit);
|
||||
|
||||
newCommit = this.cherrypick(arg);
|
||||
|
||||
afterSnapshot = this.gitVisuals.genSnapshot();
|
||||
animationResponse.rebaseSteps.push({
|
||||
oldCommit: oldCommit,
|
||||
newCommit: newCommit,
|
||||
beforeSnapshot: beforeSnapshot,
|
||||
afterSnapshot: this.gitVisuals.genSnapshot()
|
||||
});
|
||||
beforeSnapshot = afterSnapshot;
|
||||
}, this);
|
||||
|
||||
this.animationFactory.rebaseAnimation(this.animationQueue, animationResponse, this, this.gitVisuals);
|
||||
};
|
||||
|
||||
GitEngine.prototype.cherrypick = function(ref) {
|
||||
var commit = this.getCommitFromRef(ref);
|
||||
// check if we already have that
|
||||
var set = this.getUpstreamSet('HEAD');
|
||||
if (set[commit.get('id')]) {
|
||||
throw new GitError({
|
||||
msg: "We already have that commit in our changes history! You can't cherry-pick it " +
|
||||
"if it shows up in git log."
|
||||
});
|
||||
}
|
||||
|
||||
// alter the ID slightly
|
||||
var id = this.rebaseAltID(commit.get('id'));
|
||||
|
@ -545,6 +576,7 @@ GitEngine.prototype.cherrypick = function(ref) {
|
|||
// now commit with that id onto HEAD
|
||||
var newCommit = this.makeCommit([this.getCommitFromRef('HEAD')], id);
|
||||
this.setTargetLocation(this.HEAD, newCommit);
|
||||
|
||||
return newCommit;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue