[Origin] Fixed pull command throwing too early during no fetch case

This commit is contained in:
Peter Cottle 2013-07-04 17:27:03 -07:00
parent 63a88a6885
commit 92e2e303ed
6 changed files with 84 additions and 21 deletions

View file

@ -7874,8 +7874,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
target, target,
source, source,
targetBranch, targetBranch,
sourceBranch sourceBranch,
options
) { ) {
options = options || {};
sourceBranch = source.resolveID(sourceBranch); sourceBranch = source.resolveID(sourceBranch);
var targetSet = target.getUpstreamSet(targetBranch); var targetSet = target.getUpstreamSet(targetBranch);
@ -7885,9 +7887,14 @@ GitEngine.prototype.getTargetGraphDifference = function(
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')]; var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
if (target.refs[sourceStartCommitJSON.id]) { if (target.refs[sourceStartCommitJSON.id]) {
throw new GitError({ // either we throw since theres no work to be done, or we return an empty array
msg: intl.str('git-error-origin-fetch-uptodate') if (options.dontThrowOnNoFetch) {
}); return [];
} else {
throw new GitError({
msg: intl.str('git-error-origin-fetch-uptodate')
});
}
} }
// ok great, we have our starting point and our stopping set. lets go ahead // ok great, we have our starting point and our stopping set. lets go ahead
@ -8050,9 +8057,22 @@ GitEngine.prototype.fetch = function(options) {
this, this,
this.origin, this.origin,
localBranch, localBranch,
remoteBranch remoteBranch,
options
); );
if (commitsToMake.length === 0) {
this.command.addWarning(intl.str(
'git-error-origin-fetch-uptodate'
));
// no fetch needed...
var d = Q.defer();
return {
deferred: d,
chain: d.promise
};
}
var makeCommit = _.bind(function(id, parentIDs) { var makeCommit = _.bind(function(id, parentIDs) {
// need to get the parents first. since we order by depth, we know // need to get the parents first. since we order by depth, we know
// the dependencies are there already // the dependencies are there already
@ -8125,7 +8145,8 @@ GitEngine.prototype.pull = function() {
// no matter what fetch // no matter what fetch
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true,
dontThrowOnNoFetch: true
}); });
// then either rebase or merge // then either rebase or merge
if (this.commandOptions['--rebase']) { if (this.commandOptions['--rebase']) {
@ -24249,8 +24270,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
target, target,
source, source,
targetBranch, targetBranch,
sourceBranch sourceBranch,
options
) { ) {
options = options || {};
sourceBranch = source.resolveID(sourceBranch); sourceBranch = source.resolveID(sourceBranch);
var targetSet = target.getUpstreamSet(targetBranch); var targetSet = target.getUpstreamSet(targetBranch);
@ -24260,9 +24283,14 @@ GitEngine.prototype.getTargetGraphDifference = function(
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')]; var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
if (target.refs[sourceStartCommitJSON.id]) { if (target.refs[sourceStartCommitJSON.id]) {
throw new GitError({ // either we throw since theres no work to be done, or we return an empty array
msg: intl.str('git-error-origin-fetch-uptodate') if (options.dontThrowOnNoFetch) {
}); return [];
} else {
throw new GitError({
msg: intl.str('git-error-origin-fetch-uptodate')
});
}
} }
// ok great, we have our starting point and our stopping set. lets go ahead // ok great, we have our starting point and our stopping set. lets go ahead
@ -24425,9 +24453,22 @@ GitEngine.prototype.fetch = function(options) {
this, this,
this.origin, this.origin,
localBranch, localBranch,
remoteBranch remoteBranch,
options
); );
if (commitsToMake.length === 0) {
this.command.addWarning(intl.str(
'git-error-origin-fetch-uptodate'
));
// no fetch needed...
var d = Q.defer();
return {
deferred: d,
chain: d.promise
};
}
var makeCommit = _.bind(function(id, parentIDs) { var makeCommit = _.bind(function(id, parentIDs) {
// need to get the parents first. since we order by depth, we know // need to get the parents first. since we order by depth, we know
// the dependencies are there already // the dependencies are there already
@ -24500,7 +24541,8 @@ GitEngine.prototype.pull = function() {
// no matter what fetch // no matter what fetch
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true,
dontThrowOnNoFetch: true
}); });
// then either rebase or merge // then either rebase or merge
if (this.commandOptions['--rebase']) { if (this.commandOptions['--rebase']) {

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

@ -434,7 +434,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.b4338512.js"></script> <script src="build/bundle.min.25da6a44.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

@ -755,8 +755,10 @@ GitEngine.prototype.getTargetGraphDifference = function(
target, target,
source, source,
targetBranch, targetBranch,
sourceBranch sourceBranch,
options
) { ) {
options = options || {};
sourceBranch = source.resolveID(sourceBranch); sourceBranch = source.resolveID(sourceBranch);
var targetSet = target.getUpstreamSet(targetBranch); var targetSet = target.getUpstreamSet(targetBranch);
@ -766,9 +768,14 @@ GitEngine.prototype.getTargetGraphDifference = function(
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')]; var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
if (target.refs[sourceStartCommitJSON.id]) { if (target.refs[sourceStartCommitJSON.id]) {
throw new GitError({ // either we throw since theres no work to be done, or we return an empty array
msg: intl.str('git-error-origin-fetch-uptodate') if (options.dontThrowOnNoFetch) {
}); return [];
} else {
throw new GitError({
msg: intl.str('git-error-origin-fetch-uptodate')
});
}
} }
// ok great, we have our starting point and our stopping set. lets go ahead // ok great, we have our starting point and our stopping set. lets go ahead
@ -931,9 +938,22 @@ GitEngine.prototype.fetch = function(options) {
this, this,
this.origin, this.origin,
localBranch, localBranch,
remoteBranch remoteBranch,
options
); );
if (commitsToMake.length === 0) {
this.command.addWarning(intl.str(
'git-error-origin-fetch-uptodate'
));
// no fetch needed...
var d = Q.defer();
return {
deferred: d,
chain: d.promise
};
}
var makeCommit = _.bind(function(id, parentIDs) { var makeCommit = _.bind(function(id, parentIDs) {
// need to get the parents first. since we order by depth, we know // need to get the parents first. since we order by depth, we know
// the dependencies are there already // the dependencies are there already
@ -1006,7 +1026,8 @@ GitEngine.prototype.pull = function() {
// no matter what fetch // no matter what fetch
var pendingFetch = this.fetch({ var pendingFetch = this.fetch({
dontResolvePromise: true dontResolvePromise: true,
dontThrowOnNoFetch: true
}); });
// then either rebase or merge // then either rebase or merge
if (this.commandOptions['--rebase']) { if (this.commandOptions['--rebase']) {