From 016f0f45f15c74c13c2a045d54fe64bb9ad094a1 Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Fri, 25 Oct 2013 17:54:50 -0700 Subject: [PATCH] sweet new level --- src/js/git/index.js | 2 +- src/levels/index.js | 3 ++- src/levels/remote/pushArgs2.js | 43 +++++++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/js/git/index.js b/src/js/git/index.js index 002cefec..c6ddebec 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1005,7 +1005,7 @@ GitEngine.prototype.push = function(options) { }, this); chain = chain.then(_.bind(function() { - var localLocationID = sourceLocation.get('target').get('id'); + var localLocationID = this.getCommitFromRef(sourceLocation).get('id'); var remoteCommit = this.origin.refs[localLocationID]; this.origin.setTargetLocation(branchOnRemote, remoteCommit); // unhighlight local diff --git a/src/levels/index.js b/src/levels/index.js index bcf445b4..e16594e9 100644 --- a/src/levels/index.js +++ b/src/levels/index.js @@ -40,7 +40,8 @@ exports.levelSequences = { require('./remote/pushManyFeatures').level, require('./remote/mergeManyFeatures').level, require('./remote/tracking').level, - require('./remote/pushArgs').level + require('./remote/pushArgs').level, + require('./remote/pushArgs2').level ] }; diff --git a/src/levels/remote/pushArgs2.js b/src/levels/remote/pushArgs2.js index 2256e5bb..6c37d9fe 100644 --- a/src/levels/remote/pushArgs2.js +++ b/src/levels/remote/pushArgs2.js @@ -1,11 +1,12 @@ exports.level = { - "goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C2\",\"id\":\"master\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}", - "solutionCommand": "git commit ", + "goalTreeString": "{\"branches\":{\"master\":{\"target\":\"C6\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"foo\":{\"target\":\"C4\",\"id\":\"foo\",\"remoteTrackingBranchID\":\"o/foo\"},\"o/master\":{\"target\":\"C4\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null},\"o/foo\":{\"target\":\"C5\",\"id\":\"o/foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C2\",\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C2\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C4\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"foo\":{\"target\":\"C5\",\"id\":\"foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C5\":{\"parents\":[\"C2\"],\"id\":\"C5\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C2\",\"C3\"],\"id\":\"C4\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}}", + "solutionCommand": "git push origin master^:foo;git push origin foo:master", + "startTree": "{\"branches\":{\"master\":{\"target\":\"C6\",\"id\":\"master\",\"remoteTrackingBranchID\":\"o/master\"},\"foo\":{\"target\":\"C4\",\"id\":\"foo\",\"remoteTrackingBranchID\":\"o/foo\"},\"o/master\":{\"target\":\"C1\",\"id\":\"o/master\",\"remoteTrackingBranchID\":null},\"o/foo\":{\"target\":\"C1\",\"id\":\"o/foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"},\"C2\":{\"parents\":[\"C1\"],\"id\":\"C2\"},\"C3\":{\"parents\":[\"C1\"],\"id\":\"C3\"},\"C4\":{\"parents\":[\"C2\",\"C3\"],\"id\":\"C4\"},\"C5\":{\"parents\":[\"C2\"],\"id\":\"C5\"},\"C6\":{\"parents\":[\"C5\"],\"id\":\"C6\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"},\"originTree\":{\"branches\":{\"master\":{\"target\":\"C1\",\"id\":\"master\",\"remoteTrackingBranchID\":null},\"foo\":{\"target\":\"C1\",\"id\":\"foo\",\"remoteTrackingBranchID\":null}},\"commits\":{\"C0\":{\"parents\":[],\"id\":\"C0\",\"rootCommit\":true},\"C1\":{\"parents\":[\"C0\"],\"id\":\"C1\"}},\"HEAD\":{\"target\":\"master\",\"id\":\"HEAD\"}}}", "name": { "en_US": "asd" }, "hint": { - "en_US": "" + "en_US": "Remember you can admit defeat and type in \"see solution\" :P" }, "startDialog": { "en_US": { @@ -39,6 +40,42 @@ exports.level = { "Once you are specifying both the source and destination independently, you can get quite fancy and precise with remote commands. Let's see a demo!" ] } + }, + { + "type": "GitDemonstrationView", + "options": { + "beforeMarkdowns": [ + "Remember, `source` is any location that git will understand:" + ], + "afterMarkdowns": [ + "Woah! That's a pretty trippy command but it makes sense -- git resolved `foo^` into a location, uploaded whatever commits weren't present yet, and then updated destination." + ], + "command": "git push origin foo^:master", + "beforeCommand": "git clone; go -b foo; git commit; git commit" + } + }, + { + "type": "GitDemonstrationView", + "options": { + "beforeMarkdowns": [ + "What if the destination you want to push doesn't exist? No problem! Just give a branch name and git will create the branch on the remote for you" + ], + "afterMarkdowns": [ + "Sweet, that's pretty slick :D" + ], + "command": "git push origin master:newBranch", + "beforeCommand": "git clone; git commit" + } + }, + { + "type": "ModalAlert", + "options": { + "markdowns": [ + "For this level, try to get to the end goal state shown in the visualization, and remember the format of:", + "", + "`:`" + ] + } } ] }