diff --git a/spec/base.js b/spec/base.js index 11e15a11..3a90c1bf 100644 --- a/spec/base.js +++ b/spec/base.js @@ -17,6 +17,12 @@ var compareAnswer = function(headless, expectedJSON) { 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 command = levelBlob.solutionCommand; if (command.indexOf('git rebase -i') !== -1) { @@ -52,13 +58,20 @@ var expectTreeAsync = function(command, expectedJSON) { }); waitsFor(function() { var diff = (Date.now() - start); - if (diff > TIME - 20 && !haveReported) { + if (diff > TIME - 40 && !haveReported) { haveReported = true; + var expected = loadTree(expectedJSON); console.log('not going to match', command); - console.log('expected\n>>>>>>>>\n', loadTree(expectedJSON)); - console.log('\n<<<<<<<<<<<\nactual', headless.gitEngine.exportTree()); + console.log('expected\n>>>>>>>>\n', expected); + console.log('\n<<<<<<<<<<<\nactual', getHeadlessSummary(headless)); console.log('\n<<<>>>>\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); }, 'trees should be equal', 100); diff --git a/spec/remote.spec.js b/spec/remote.spec.js index c44bf44c..752f19dd 100644 --- a/spec/remote.spec.js +++ b/spec/remote.spec.js @@ -236,7 +236,7 @@ describe('Git Remotes', function() { it('fetches only one remote if specified', function() { expectTreeAsync( '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"}}}' ); }); diff --git a/src/js/git/commands.js b/src/js/git/commands.js index ec2441a6..4e9b7bba 100644 --- a/src/js/git/commands.js +++ b/src/js/git/commands.js @@ -185,14 +185,16 @@ var commandConfig = { } // 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 // merge & fetch, in which case it completely // ignores the properties of branch you are on, or // // B) specify no args, in which case it figures out // 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 var commandOptions = command.getOptionsMap(); @@ -299,10 +301,12 @@ var commandConfig = { } else if (firstArg) { // here is the deal -- its JUST like git push. the first arg // is used as both the destination and the source, so we need - // to make sure it exists as the source on REMOTE and then - // the destination will be created locally + // to make sure it exists as the source on REMOTE. however + // technically we have a destination here as the remote branch 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 assertIsRef(engine.origin, source); diff --git a/src/levels/index.js b/src/levels/index.js index e626be56..78a27f2b 100644 --- a/src/levels/index.js +++ b/src/levels/index.js @@ -38,8 +38,9 @@ exports.levelSequences = { ], remoteAdvanced: [ require('./remote/pushManyFeatures').level, - require('./remote/mergeManyFeatures').level - require('./remote/tracking').level + require('./remote/mergeManyFeatures').level, + require('./remote/tracking').level, + require('./remote/place').level ] }; diff --git a/todo.txt b/todo.txt index 9380e9f2..e88b89be 100644 --- a/todo.txt +++ b/todo.txt @@ -50,6 +50,7 @@ Ideas for cleaning Done things: (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] EASY -- make colors the same between remote branches and their remote counterparts [x] fix undo not syncing the remote tracking