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