mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
fixed merge case with existing commits
This commit is contained in:
parent
87c787c8af
commit
67570f716d
7 changed files with 67 additions and 23 deletions
|
@ -7384,9 +7384,8 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
AnimationFactory.playRefreshAnimationAndFinish(this.gitVisuals, this.animationQueue);
|
AnimationFactory.playRefreshAnimationAndFinish(this.gitVisuals, this.animationQueue);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// TODO handle the case where the master target on origin is not present
|
// we only clone from our current state, so we can safely assume all of our
|
||||||
// locally, so we have to go up the chain. for now we assume the master on
|
// local commits are on origin
|
||||||
// origin is at least present.
|
|
||||||
var originTree = JSON.parse(unescape(treeString));
|
var originTree = JSON.parse(unescape(treeString));
|
||||||
// make an origin branch for each branch mentioned in the tree
|
// make an origin branch for each branch mentioned in the tree
|
||||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||||
|
@ -7971,6 +7970,14 @@ GitEngine.prototype.push = function(options) {
|
||||||
localBranch
|
localBranch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// now here is the tricky part -- the difference between local master
|
||||||
|
// and remote master might be commits C2, C3, and C4, but the remote
|
||||||
|
// might already have those commits. In this case, we dont need to
|
||||||
|
// make them, so filter these out
|
||||||
|
commitsToMake = _.filter(commitsToMake, function(commitJSON) {
|
||||||
|
return !this.origin.refs[commitJSON.id];
|
||||||
|
}, this);
|
||||||
|
|
||||||
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
|
||||||
|
@ -8281,7 +8288,6 @@ GitEngine.prototype.fakeTeamwork = function(numToMake, branch) {
|
||||||
this.origin.gitVisuals
|
this.origin.gitVisuals
|
||||||
);
|
);
|
||||||
}, this);
|
}, this);
|
||||||
var chainStepWrap = function() { return chainStep(); };
|
|
||||||
|
|
||||||
var deferred = Q.defer();
|
var deferred = Q.defer();
|
||||||
var chain = deferred.promise;
|
var chain = deferred.promise;
|
||||||
|
@ -8652,8 +8658,8 @@ GitEngine.prototype.dateSortFunc = function(cA, cB) {
|
||||||
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
||||||
// we strip off the date creation field, when loading a tree from string this fails :-/
|
// we strip off the date creation field, when loading a tree from string this fails :-/
|
||||||
// there's actually no way to determine it...
|
// there's actually no way to determine it...
|
||||||
//console.warn('WUT it is equal');
|
//c.warn('WUT it is equal');
|
||||||
//console.log(cA, cB);
|
//c.log(cA, cB);
|
||||||
return GitEngine.prototype.idSortFunc(cA, cB);
|
return GitEngine.prototype.idSortFunc(cA, cB);
|
||||||
}
|
}
|
||||||
return dateA - dateB;
|
return dateA - dateB;
|
||||||
|
@ -22450,10 +22456,19 @@ function getMockFactory() {
|
||||||
}
|
}
|
||||||
// special method that does stuff
|
// special method that does stuff
|
||||||
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
||||||
console.log('trying to finish');
|
|
||||||
aQueue.thenFinish(Q.defer().promise);
|
aQueue.thenFinish(Q.defer().promise);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||||
|
var d = Q.defer();
|
||||||
|
d.resolve();
|
||||||
|
return d.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
|
||||||
return mockFactory;
|
return mockFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23478,10 +23493,19 @@ function getMockFactory() {
|
||||||
}
|
}
|
||||||
// special method that does stuff
|
// special method that does stuff
|
||||||
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
||||||
console.log('trying to finish');
|
|
||||||
aQueue.thenFinish(Q.defer().promise);
|
aQueue.thenFinish(Q.defer().promise);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||||
|
var d = Q.defer();
|
||||||
|
d.resolve();
|
||||||
|
return d.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
|
||||||
return mockFactory;
|
return mockFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23790,9 +23814,8 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
AnimationFactory.playRefreshAnimationAndFinish(this.gitVisuals, this.animationQueue);
|
AnimationFactory.playRefreshAnimationAndFinish(this.gitVisuals, this.animationQueue);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// TODO handle the case where the master target on origin is not present
|
// we only clone from our current state, so we can safely assume all of our
|
||||||
// locally, so we have to go up the chain. for now we assume the master on
|
// local commits are on origin
|
||||||
// origin is at least present.
|
|
||||||
var originTree = JSON.parse(unescape(treeString));
|
var originTree = JSON.parse(unescape(treeString));
|
||||||
// make an origin branch for each branch mentioned in the tree
|
// make an origin branch for each branch mentioned in the tree
|
||||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||||
|
@ -24377,6 +24400,14 @@ GitEngine.prototype.push = function(options) {
|
||||||
localBranch
|
localBranch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// now here is the tricky part -- the difference between local master
|
||||||
|
// and remote master might be commits C2, C3, and C4, but the remote
|
||||||
|
// might already have those commits. In this case, we dont need to
|
||||||
|
// make them, so filter these out
|
||||||
|
commitsToMake = _.filter(commitsToMake, function(commitJSON) {
|
||||||
|
return !this.origin.refs[commitJSON.id];
|
||||||
|
}, this);
|
||||||
|
|
||||||
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
|
||||||
|
@ -24687,7 +24718,6 @@ GitEngine.prototype.fakeTeamwork = function(numToMake, branch) {
|
||||||
this.origin.gitVisuals
|
this.origin.gitVisuals
|
||||||
);
|
);
|
||||||
}, this);
|
}, this);
|
||||||
var chainStepWrap = function() { return chainStep(); };
|
|
||||||
|
|
||||||
var deferred = Q.defer();
|
var deferred = Q.defer();
|
||||||
var chain = deferred.promise;
|
var chain = deferred.promise;
|
||||||
|
@ -25058,8 +25088,8 @@ GitEngine.prototype.dateSortFunc = function(cA, cB) {
|
||||||
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
||||||
// we strip off the date creation field, when loading a tree from string this fails :-/
|
// we strip off the date creation field, when loading a tree from string this fails :-/
|
||||||
// there's actually no way to determine it...
|
// there's actually no way to determine it...
|
||||||
//console.warn('WUT it is equal');
|
//c.warn('WUT it is equal');
|
||||||
//console.log(cA, cB);
|
//c.log(cA, cB);
|
||||||
return GitEngine.prototype.idSortFunc(cA, cB);
|
return GitEngine.prototype.idSortFunc(cA, cB);
|
||||||
}
|
}
|
||||||
return dateA - dateB;
|
return dateA - dateB;
|
||||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.ad27f098.js
Normal file
1
build/bundle.min.ad27f098.js
Normal file
File diff suppressed because one or more lines are too long
2
build/bundle.min.js
vendored
2
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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.141ecc64.js"></script>
|
<script src="build/bundle.min.ad27f098.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
|
||||||
|
|
|
@ -26,10 +26,19 @@ function getMockFactory() {
|
||||||
}
|
}
|
||||||
// special method that does stuff
|
// special method that does stuff
|
||||||
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
mockFactory.playRefreshAnimationAndFinish = function(gitVisuals, aQueue) {
|
||||||
console.log('trying to finish');
|
|
||||||
aQueue.thenFinish(Q.defer().promise);
|
aQueue.thenFinish(Q.defer().promise);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||||
|
var d = Q.defer();
|
||||||
|
d.resolve();
|
||||||
|
return d.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||||
|
return chain;
|
||||||
|
};
|
||||||
|
|
||||||
return mockFactory;
|
return mockFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -851,6 +851,14 @@ GitEngine.prototype.push = function(options) {
|
||||||
localBranch
|
localBranch
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// now here is the tricky part -- the difference between local master
|
||||||
|
// and remote master might be commits C2, C3, and C4, but the remote
|
||||||
|
// might already have those commits. In this case, we dont need to
|
||||||
|
// make them, so filter these out
|
||||||
|
commitsToMake = _.filter(commitsToMake, function(commitJSON) {
|
||||||
|
return !this.origin.refs[commitJSON.id];
|
||||||
|
}, this);
|
||||||
|
|
||||||
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
|
||||||
|
@ -943,9 +951,6 @@ GitEngine.prototype.fetch = function(options) {
|
||||||
remoteBranch,
|
remoteBranch,
|
||||||
options
|
options
|
||||||
);
|
);
|
||||||
// remove the ones that already exist (and were missed by our
|
|
||||||
// upwards search)
|
|
||||||
commitsToMake = _.filter(commitsToMake
|
|
||||||
|
|
||||||
if (commitsToMake.length === 0) {
|
if (commitsToMake.length === 0) {
|
||||||
this.command.addWarning(intl.str(
|
this.command.addWarning(intl.str(
|
||||||
|
@ -1534,8 +1539,8 @@ GitEngine.prototype.dateSortFunc = function(cA, cB) {
|
||||||
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
// hmmmmm this still needs fixing. we need to know basically just WHEN a commit was created, but since
|
||||||
// we strip off the date creation field, when loading a tree from string this fails :-/
|
// we strip off the date creation field, when loading a tree from string this fails :-/
|
||||||
// there's actually no way to determine it...
|
// there's actually no way to determine it...
|
||||||
//console.warn('WUT it is equal');
|
//c.warn('WUT it is equal');
|
||||||
//console.log(cA, cB);
|
//c.log(cA, cB);
|
||||||
return GitEngine.prototype.idSortFunc(cA, cB);
|
return GitEngine.prototype.idSortFunc(cA, cB);
|
||||||
}
|
}
|
||||||
return dateA - dateB;
|
return dateA - dateB;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue