git pull --rebase now done

This commit is contained in:
Peter Cottle 2013-06-11 20:41:43 -07:00
parent 69e6cc0472
commit bbfb4d7512
6 changed files with 168 additions and 24 deletions

View file

@ -999,12 +999,50 @@ GitEngine.prototype.pull = function() {
});
// then either rebase or merge
if (this.commandOptions['--rebase']) {
this.rebase('o/master', 'master');
this.pullFinishWithRebase(pendingFetch, localBranch, remoteBranch);
} else {
this.pullFinishWithMerge(pendingFetch, localBranch, remoteBranch);
}
};
GitEngine.prototype.pullFinishWithRebase = function(
pendingFetch,
localBranch,
remoteBranch
) {
var chain = pendingFetch.chain;
var deferred = pendingFetch.deferred;
// delay a bit after the intense refresh animation from
// fetch
chain = chain.then(function() {
return AnimationFactory.getDelayedPromise(300);
});
chain = chain.then(_.bind(function() {
// highlight last commit on o/master to color of
// local branch
return AnimationFactory.playHighlightPromiseAnimation(
this.getCommitFromRef(remoteBranch),
localBranch
);
}, this));
chain = chain.then(_.bind(function() {
pendingFetch.dontResolvePromise = true;
return this.rebase(remoteBranch, localBranch, pendingFetch);
}, this));
chain = chain.then(_.bind(function() {
// HAX
var localCommit = localBranch.get('target');
this.setTargetLocation(this.refs['o/master'], localCommit);
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}, this));
this.animationQueue.thenFinish(chain, deferred);
};
GitEngine.prototype.pullFinishWithMerge = function(
pendingFetch,
localBranch,
@ -1484,7 +1522,7 @@ GitEngine.prototype.rebaseStarter = function() {
this.rebase(this.generalArgs[0], this.generalArgs[1]);
};
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
GitEngine.prototype.rebase = function(targetSource, currentLocation, options) {
// first some conditions
if (this.isUpstreamOf(targetSource, currentLocation)) {
this.command.setResult(intl.str('git-result-uptodate'));
@ -1535,7 +1573,7 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
pQueue = pQueue.concat(popped.get('parents'));
}
this.rebaseFinish(toRebaseRough, stopSet, targetSource, currentLocation);
return this.rebaseFinish(toRebaseRough, stopSet, targetSource, currentLocation, options);
};
GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation) {
@ -1645,11 +1683,18 @@ GitEngine.prototype.filterRebaseCommits = function(toRebaseRough, stopSet) {
}, this);
};
GitEngine.prototype.rebaseFinish = function(toRebaseRough, stopSet, targetSource, currentLocation) {
GitEngine.prototype.rebaseFinish = function(
toRebaseRough,
stopSet,
targetSource,
currentLocation,
options
) {
options = options || {};
// now we have the all the commits between currentLocation and the set of target to rebase.
var destinationBranch = this.resolveID(targetSource);
var deferred = Q.defer();
var chain = deferred.promise;
var deferred = options.deferred || Q.defer();
var chain = options.chain || deferred.promise;
var toRebase = this.filterRebaseCommits(toRebaseRough, stopSet);
if (!toRebase.length) {
@ -1698,7 +1743,10 @@ GitEngine.prototype.rebaseFinish = function(toRebaseRough, stopSet, targetSource
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}, this));
this.animationQueue.thenFinish(chain, deferred);
if (!options.dontResolvePromise) {
this.animationQueue.thenFinish(chain, deferred);
}
return chain;
};
GitEngine.prototype.mergeStarter = function() {