mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-13 08:04:27 +02:00
awesome, git fetch working super well
This commit is contained in:
parent
d18633c608
commit
b090cef461
8 changed files with 1230 additions and 37 deletions
|
@ -774,27 +774,35 @@ GitEngine.prototype.getTargetGraphDifference = function(
|
|||
var sourceTree = source.exportTree();
|
||||
var sourceStartCommitJSON = sourceTree.commits[sourceStartCommit.get('id')];
|
||||
|
||||
if (this.refs[sourceStartCommitJSON.id]) {
|
||||
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
|
||||
// and traverse upwards and keep track of depth manually
|
||||
sourceStartCommitJSON.depth = 0;
|
||||
var difference = [];
|
||||
var toExplore = [sourceStartCommitJSON];
|
||||
|
||||
var pushParent = function(parentID) {
|
||||
if (targetSet[parentID]) {
|
||||
// we already have this commit, lets bounce
|
||||
return;
|
||||
}
|
||||
|
||||
var parentJSON = sourceTree.commits[parentID];
|
||||
parentJSON.depth = here.depth + 1;
|
||||
toExplore.push(parentJSON);
|
||||
};
|
||||
|
||||
while (toExplore.length) {
|
||||
var here = toExplore.pop();
|
||||
difference.push(here);
|
||||
|
||||
_.each(here.parents, function(parentID) {
|
||||
if (targetSet[parentID]) {
|
||||
// we already have this commit, lets bounce
|
||||
return;
|
||||
}
|
||||
|
||||
var parentJSON = sourceTree.commits[parentID];
|
||||
parentJSON.depth = here.depth + 1;
|
||||
toExplore.push(parentJSON);
|
||||
}, this);
|
||||
_.each(here.parents, pushParent);
|
||||
}
|
||||
|
||||
return difference.sort(function(cA, cB) {
|
||||
// reverse sort by depth
|
||||
return cB.depth - cA.depth;
|
||||
|
@ -844,18 +852,27 @@ GitEngine.prototype.fetch = function() {
|
|||
var chain = deferred.promise;
|
||||
|
||||
_.each(commitsToMake, function(commitJSON) {
|
||||
chain = chain.then(_.bind(function() {
|
||||
return AnimationFactory.playHighlightPromiseAnimation(
|
||||
this.origin.refs[commitJSON.id],
|
||||
localBranch
|
||||
);
|
||||
}, this));
|
||||
|
||||
chain = chain.then(function() {
|
||||
return chainStep(
|
||||
commitJSON.id,
|
||||
commitJSON.parents
|
||||
);
|
||||
});
|
||||
});
|
||||
}, this);
|
||||
|
||||
chain = chain.then(_.bind(function() {
|
||||
var originLocationID = remoteBranch.get('target').get('id');
|
||||
var localCommit = this.refs[originLocationID];
|
||||
this.setTargetLocation(localBranch, localCommit);
|
||||
// unhighlight origin
|
||||
AnimationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
|
||||
}, this));
|
||||
|
||||
|
|
|
@ -52,6 +52,10 @@ exports.strings = {
|
|||
'en_US': 'Quick commit. Go Bears!',
|
||||
'zh_CN': '快速提交。上啊月熊!'
|
||||
},
|
||||
'git-error-origin-fetch-uptodate': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'Already up to date!'
|
||||
},
|
||||
'git-error-origin-fetch-no-ff': {
|
||||
'__desc__': 'One of the error messages for git',
|
||||
'en_US': 'Your origin branch is out of sync with the remote branch and fetch cannot be performed. try using --force'
|
||||
|
|
|
@ -138,6 +138,7 @@ var VisNode = VisBase.extend({
|
|||
circle: {
|
||||
fill: color,
|
||||
stroke: color,
|
||||
'stroke-dasharray': '',
|
||||
'stroke-width': this.get('stroke-width') * 5
|
||||
},
|
||||
text: {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue