awesome new pull animation

This commit is contained in:
Peter Cottle 2013-06-10 21:30:54 -07:00
parent d80ae31adc
commit 3458cc17af
6 changed files with 159 additions and 123 deletions

View file

@ -7924,8 +7924,7 @@ GitEngine.prototype.fetch = function(options) {
} }
return { return {
chain: chain, chain: chain,
deferred: deferred, deferred: deferred
lastCommitID: commitsToMake.pop().id
}; };
}; };
@ -7948,44 +7947,61 @@ GitEngine.prototype.pull = function() {
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true
}); });
// then either rebase or merge
if (this.commandOptions['--rebase']) {
this.rebase('o/master', 'master');
} else {
this.pullFinishWithMerge(pendingFetch, localBranch, remoteBranch);
}
};
GitEngine.prototype.pullFinishWithMerge = function(
pendingFetch,
localBranch,
remoteBranch
) {
var chain = pendingFetch.chain; var chain = pendingFetch.chain;
var deferred = pendingFetch.deferred; var deferred = pendingFetch.deferred;
// then either rebase or merge // delay a bit after the intense refresh animation from
if (this.commandOptions['--rebase']) { // fetch
this.rebaseFinisher('o/master', 'master');
} else {
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(300);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight last commit on o/master // highlight last commit on o/master to color of
var commit = this.refs[pendingFetch.lastCommitID]; // local branch
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
commit, this.getCommitFromRef(remoteBranch),
localBranch localBranch
); );
}, this)); }, this));
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight commit on master to color of remote
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
this.getCommitFromRef('master'), this.getCommitFromRef(localBranch),
remoteBranch remoteBranch
); );
}, this)); }, this));
// delay and merge
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(700);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
var newCommit = this.merge('o/master'); var newCommit = this.merge('o/master');
if (!newCommit) {
// it is a fast forward
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}
return AnimationFactory.playCommitBirthPromiseAnimation( return AnimationFactory.playCommitBirthPromiseAnimation(
newCommit, newCommit,
this.gitVisuals this.gitVisuals
); );
}, this)); }, this));
}
this.animationQueue.thenFinish(chain, deferred); this.animationQueue.thenFinish(chain, deferred);
}; };
@ -8415,11 +8431,7 @@ GitEngine.prototype.rebaseStarter = function() {
} }
this.twoArgsImpliedHead(this.generalArgs); this.twoArgsImpliedHead(this.generalArgs);
this.rebaseFinisher(this.generalArgs[0], this.generalArgs[1]); this.rebase(this.generalArgs[0], this.generalArgs[1]);
};
GitEngine.prototype.rebaseFinisher = function(targetSource, currentLocation) {
this.rebase(targetSource, currentLocation);
}; };
GitEngine.prototype.rebase = function(targetSource, currentLocation) { GitEngine.prototype.rebase = function(targetSource, currentLocation) {
@ -23907,8 +23919,7 @@ GitEngine.prototype.fetch = function(options) {
} }
return { return {
chain: chain, chain: chain,
deferred: deferred, deferred: deferred
lastCommitID: commitsToMake.pop().id
}; };
}; };
@ -23931,44 +23942,61 @@ GitEngine.prototype.pull = function() {
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true
}); });
// then either rebase or merge
if (this.commandOptions['--rebase']) {
this.rebase('o/master', 'master');
} else {
this.pullFinishWithMerge(pendingFetch, localBranch, remoteBranch);
}
};
GitEngine.prototype.pullFinishWithMerge = function(
pendingFetch,
localBranch,
remoteBranch
) {
var chain = pendingFetch.chain; var chain = pendingFetch.chain;
var deferred = pendingFetch.deferred; var deferred = pendingFetch.deferred;
// then either rebase or merge // delay a bit after the intense refresh animation from
if (this.commandOptions['--rebase']) { // fetch
this.rebaseFinisher('o/master', 'master');
} else {
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(300);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight last commit on o/master // highlight last commit on o/master to color of
var commit = this.refs[pendingFetch.lastCommitID]; // local branch
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
commit, this.getCommitFromRef(remoteBranch),
localBranch localBranch
); );
}, this)); }, this));
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight commit on master to color of remote
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
this.getCommitFromRef('master'), this.getCommitFromRef(localBranch),
remoteBranch remoteBranch
); );
}, this)); }, this));
// delay and merge
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(700);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
var newCommit = this.merge('o/master'); var newCommit = this.merge('o/master');
if (!newCommit) {
// it is a fast forward
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}
return AnimationFactory.playCommitBirthPromiseAnimation( return AnimationFactory.playCommitBirthPromiseAnimation(
newCommit, newCommit,
this.gitVisuals this.gitVisuals
); );
}, this)); }, this));
}
this.animationQueue.thenFinish(chain, deferred); this.animationQueue.thenFinish(chain, deferred);
}; };
@ -24398,11 +24426,7 @@ GitEngine.prototype.rebaseStarter = function() {
} }
this.twoArgsImpliedHead(this.generalArgs); this.twoArgsImpliedHead(this.generalArgs);
this.rebaseFinisher(this.generalArgs[0], this.generalArgs[1]); this.rebase(this.generalArgs[0], this.generalArgs[1]);
};
GitEngine.prototype.rebaseFinisher = function(targetSource, currentLocation) {
this.rebase(targetSource, currentLocation);
}; };
GitEngine.prototype.rebase = function(targetSource, currentLocation) { GitEngine.prototype.rebase = function(targetSource, currentLocation) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -426,7 +426,7 @@
For a much easier time perusing the source, see the individual files at: For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching https://github.com/pcottle/learnGitBranching
--> -->
<script src="build/bundle.min.4369b0c9.js"></script> <script src="build/bundle.min.701641cf.js"></script>
<!-- The advantage of github pages: super-easy, simple, slick static hostic. <!-- 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 The downside? No raw logs to parse for analytics, so I have to include

View file

@ -882,8 +882,7 @@ GitEngine.prototype.fetch = function(options) {
} }
return { return {
chain: chain, chain: chain,
deferred: deferred, deferred: deferred
lastCommitID: commitsToMake.pop().id
}; };
}; };
@ -906,44 +905,61 @@ GitEngine.prototype.pull = function() {
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true
}); });
// then either rebase or merge
if (this.commandOptions['--rebase']) {
this.rebase('o/master', 'master');
} else {
this.pullFinishWithMerge(pendingFetch, localBranch, remoteBranch);
}
};
GitEngine.prototype.pullFinishWithMerge = function(
pendingFetch,
localBranch,
remoteBranch
) {
var chain = pendingFetch.chain; var chain = pendingFetch.chain;
var deferred = pendingFetch.deferred; var deferred = pendingFetch.deferred;
// then either rebase or merge // delay a bit after the intense refresh animation from
if (this.commandOptions['--rebase']) { // fetch
this.rebaseFinisher('o/master', 'master');
} else {
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(300);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight last commit on o/master // highlight last commit on o/master to color of
var commit = this.refs[pendingFetch.lastCommitID]; // local branch
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
commit, this.getCommitFromRef(remoteBranch),
localBranch localBranch
); );
}, this)); }, this));
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
// highlight commit on master to color of remote
return AnimationFactory.playHighlightPromiseAnimation( return AnimationFactory.playHighlightPromiseAnimation(
this.getCommitFromRef('master'), this.getCommitFromRef(localBranch),
remoteBranch remoteBranch
); );
}, this)); }, this));
// delay and merge
chain = chain.then(function() { chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(700); return AnimationFactory.getDelayedPromise(700);
}); });
chain = chain.then(_.bind(function() { chain = chain.then(_.bind(function() {
var newCommit = this.merge('o/master'); var newCommit = this.merge('o/master');
if (!newCommit) {
// it is a fast forward
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}
return AnimationFactory.playCommitBirthPromiseAnimation( return AnimationFactory.playCommitBirthPromiseAnimation(
newCommit, newCommit,
this.gitVisuals this.gitVisuals
); );
}, this)); }, this));
}
this.animationQueue.thenFinish(chain, deferred); this.animationQueue.thenFinish(chain, deferred);
}; };
@ -1373,11 +1389,7 @@ GitEngine.prototype.rebaseStarter = function() {
} }
this.twoArgsImpliedHead(this.generalArgs); this.twoArgsImpliedHead(this.generalArgs);
this.rebaseFinisher(this.generalArgs[0], this.generalArgs[1]); this.rebase(this.generalArgs[0], this.generalArgs[1]);
};
GitEngine.prototype.rebaseFinisher = function(targetSource, currentLocation) {
this.rebase(targetSource, currentLocation);
}; };
GitEngine.prototype.rebase = function(targetSource, currentLocation) { GitEngine.prototype.rebase = function(targetSource, currentLocation) {