destination args primed

This commit is contained in:
Peter Cottle 2013-10-21 19:46:16 -07:00
parent 5947b48ce3
commit c7ba5c3afe
5 changed files with 31 additions and 12 deletions

View file

@ -17,6 +17,12 @@ var compareAnswer = function(headless, expectedJSON) {
return TreeCompare.compareTrees(expectedTree, actualTree); return TreeCompare.compareTrees(expectedTree, actualTree);
}; };
var getHeadlessSummary = function(headless) {
var tree = headless.gitEngine.exportTree();
TreeCompare.reduceTreeFields([tree]);
return tree;
};
var expectLevelAsync = function(headless, levelBlob) { var expectLevelAsync = function(headless, levelBlob) {
var command = levelBlob.solutionCommand; var command = levelBlob.solutionCommand;
if (command.indexOf('git rebase -i') !== -1) { if (command.indexOf('git rebase -i') !== -1) {
@ -52,13 +58,20 @@ var expectTreeAsync = function(command, expectedJSON) {
}); });
waitsFor(function() { waitsFor(function() {
var diff = (Date.now() - start); var diff = (Date.now() - start);
if (diff > TIME - 20 && !haveReported) { if (diff > TIME - 40 && !haveReported) {
haveReported = true; haveReported = true;
var expected = loadTree(expectedJSON);
console.log('not going to match', command); console.log('not going to match', command);
console.log('expected\n>>>>>>>>\n', loadTree(expectedJSON)); console.log('expected\n>>>>>>>>\n', expected);
console.log('\n<<<<<<<<<<<\nactual', headless.gitEngine.exportTree()); console.log('\n<<<<<<<<<<<\nactual', getHeadlessSummary(headless));
console.log('\n<<<<ORIGIN>>>>>\n'); console.log('\n<<<<ORIGIN>>>>>\n');
console.log(loadTree(expectedJSON).originTree, '\n==========\n', headless.gitEngine.exportTree().originTree); if (expected.originTree) {
console.log(expected.originTree);
console.log('\n=========\n');
console.log(getHeadlessSummary(headless).originTree);
}
console.log(expectedJSON);
console.log(JSON.stringify(getHeadlessSummary(headless)));
} }
return compareAnswer(headless, expectedJSON); return compareAnswer(headless, expectedJSON);
}, 'trees should be equal', 100); }, 'trees should be equal', 100);

View file

@ -236,7 +236,7 @@ describe('Git Remotes', function() {
it('fetches only one remote if specified', function() { it('fetches only one remote if specified', function() {
expectTreeAsync( expectTreeAsync(
'git clone;gc;git push origin master:banana;git fakeTeamwork banana;git fakeTeamwork master;git fetch origin banana', 'git clone;gc;git push origin master:banana;git fakeTeamwork banana;git fakeTeamwork master;git fetch origin banana',
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/banana":{"target":"C3","id":"o/banana","remoteTrackingBranchID":null},"banana":{"target":"C2","id":"banana","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"master","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C4","id":"master","remoteTrackingBranchID":null},"banana":{"target":"C3","id":"banana","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"},"C4":{"parents":["C1"],"id":"C4"}},"HEAD":{"target":"master","id":"HEAD"}}}' '{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":"o/master"},"o/master":{"target":"C1","id":"o/master","remoteTrackingBranchID":null},"o/banana":{"target":"C3","id":"o/banana","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"}},"HEAD":{"target":"master","id":"HEAD"},"originTree":{"branches":{"master":{"target":"C4","id":"master","remoteTrackingBranchID":null},"banana":{"target":"C3","id":"banana","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C2"],"id":"C3"},"C4":{"parents":["C1"],"id":"C4"}},"HEAD":{"target":"master","id":"HEAD"}}}'
); );
}); });

View file

@ -185,14 +185,16 @@ var commandConfig = {
} }
// here is the deal -- git pull is pretty complex with // here is the deal -- git pull is pretty complex with
// the arguments it wants. Either you can: // the arguments it wants. You can
// A) specify the remote branch you want to // A) specify the remote branch you want to
// merge & fetch, in which case it completely // merge & fetch, in which case it completely
// ignores the properties of branch you are on, or // ignores the properties of branch you are on, or
// //
// B) specify no args, in which case it figures out // B) specify no args, in which case it figures out
// the branch to fetch from the remote tracking // the branch to fetch from the remote tracking
// and merges those in. // and merges those in, or
//
// C) specify the colon refspec like fetch (where it
// so lets switch on A/B here // so lets switch on A/B here
var commandOptions = command.getOptionsMap(); var commandOptions = command.getOptionsMap();
@ -299,10 +301,12 @@ var commandConfig = {
} else if (firstArg) { } else if (firstArg) {
// here is the deal -- its JUST like git push. the first arg // here is the deal -- its JUST like git push. the first arg
// is used as both the destination and the source, so we need // is used as both the destination and the source, so we need
// to make sure it exists as the source on REMOTE and then // to make sure it exists as the source on REMOTE. however
// the destination will be created locally // technically we have a destination here as the remote branch
source = firstArg; source = firstArg;
destination = firstArg; assertIsBranch(engine.origin, source);
// get o/master locally if master is specified
destination = engine.origin.refs[source].getPrefixedID();
} }
if (source) { // empty string fails this check if (source) { // empty string fails this check
assertIsRef(engine.origin, source); assertIsRef(engine.origin, source);

View file

@ -38,8 +38,9 @@ exports.levelSequences = {
], ],
remoteAdvanced: [ remoteAdvanced: [
require('./remote/pushManyFeatures').level, require('./remote/pushManyFeatures').level,
require('./remote/mergeManyFeatures').level require('./remote/mergeManyFeatures').level,
require('./remote/tracking').level require('./remote/tracking').level,
require('./remote/place').level
] ]
}; };

View file

@ -50,6 +50,7 @@ Ideas for cleaning
Done things: Done things:
(I only started this on Dec 17th 2012 to get a better sense of what was done) (I only started this on Dec 17th 2012 to get a better sense of what was done)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[x] test is failing because we create banana when we should only really be creating o/banana
[x] work on TABBED levels layout [x] work on TABBED levels layout
[x] EASY -- make colors the same between remote branches and their remote counterparts [x] EASY -- make colors the same between remote branches and their remote counterparts
[x] fix undo not syncing the remote tracking [x] fix undo not syncing the remote tracking