finished.
diff --git a/Readme.org b/Readme.org --- a/Readme.org +++ b/Readme.org @@ -6,6 +6,8 @@ Currently I rework my code extensively b [[http://hg-lab.logilab.org/doc/mutable-history/html/index.html][hg evolve]] might offer that. +This test uses the mutable-hg extension in revision c70a1091e0d8 (24 changesets after 2.1.0). + * Tests :PROPERTIES: :tangle: runtests.sh @@ -81,7 +83,6 @@ First I do my own change. cd testmy # Now we add the bad change echo "Wishes: - - The Solek wants Action - The Judicator wants Action @@ -91,10 +92,8 @@ hg ci -Am "What the players want" hg log -G -r tip # and the good change echo "Places: - - The village - The researchers cave - " >> plan.txt hg ci -m "The places" hg log -G @@ -109,10 +108,8 @@ Now we pull the changes into the repo of hg -R testother pull -u testmy cd testother echo "People: - - The Lost - The Specter - " >> plan.txt hg ci -m "The people" hg log -G @@ -177,10 +174,9 @@ And as you can see, everything looks nic Now I go into a bit of a planning spree. -#+BEGIN_SRC sh :tangle no :exports both :results output verbatim +#+BEGIN_SRC sh :exports both :results output verbatim cd testmy -echo "Scenes: -" >> plan.txt +echo "Scenes:" >> plan.txt hg ci -m "we need scenes" echo "- Lost appears" >> plan.txt @@ -212,20 +208,109 @@ Now I apply the scenes to wishes, places #+BEGIN_SRC sh :exports both :results output verbatim cd testmy -sed -i "s/The Judicator wants Action/The Judicator wants Action - Portals/" plan.txt -sed -i "s/The village/The village - lost appears, people wanish, portals during dreamtime/" plan.txt +sed -i "s/The Judicator wants Action/The Judicator wants Action - portals/" plan.txt +sed -i "s/The village/The village - lost, vanish, portals/" plan.txt hg ci -m "Apply Scenes to people and places." hg log -G cd .. #+END_SRC -Let’s fix that. +Let’s fix that: uncommit it and Normally I would just use `hg record` to interactively select changes to record. Since this is a non-interactive test, I manually undo and redo changes instead. - +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +hg uncommit --all # to undo all changes, not just those for specified files +hg diff +sed -i "s/The village - lost, vanish, portals/The village/" plan.txt +hg amend -m "Apply scenes to wishes" +sed -i "s/The village/The village - lost, vanish, portals/" plan.txt +hg commit -m "Apply scenes to places" +hg log -G +cd .. +#+END_SRC ** …as afterthought /Do one big commit, add an atomic commit. Then split the big commit./ -** …together +Let’s get the changes from our co-gamemaster and apply people to wishes, places and scenes. Then add a scene we need to fullfill the wishes and clean the commits afterwards. +First get the changes: + +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +hg pull ../testother +hg merge --tool internal:merge tip # the new head from our co-gamemaster +# fix the conflicts +sed -i "s/<<<.*local//" plan.txt +sed -i "s/====.*/\n/" plan.txt +sed -i "s/>>>.*other//" plan.txt +hg resolve -m +hg commit -m "merge people" +hg log -G +cd .. +#+END_SRC + +Now we have all changes in our repo. We begin to apply people to wishes, places and scenes. + +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +sed -i "s/The Solek wants emotionally intense situations/The Solek wants emotionally intense situations | specter, Lost/" plan.txt +sed -i "s/Lost appears/Lost appears | Lost/" plan.txt +sed -i "s/People vanish/People vanish | Specter/" plan.txt +hg commit -m "apply people to wishes, places and scenes" +hg log -G +cat plan.txt +cd .. +#+END_SRC + +As you can see, the specter only applies to the wishes, and we miss a person for the action. + +Let’s fix that. + +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +sed -i "s/- The Specter/- The Specter\n- Wild Memories/" plan.txt +sed -i "s/- Portals during dreamtime/- Portals during dreamtime\n- Unconnected Memories/" plan.txt +hg ci -m "Added wild memories to fullfill the wish for action" +hg log -G +cat plan.txt +cd .. +#+END_SRC + +Now split the big change into applying people first to wishes, then to places and scenes. + +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +# go back to the big change +hg up -r -2 +# uncommit it +hg uncommit --all +# Now rework it into two commits +sed -i "s/- Lost appears | Lost/- Lost appears/" plan.txt +sed -i "s/- People vanish | Specter/- People vanish/" plan.txt +hg amend -m "Apply people to wishes" +sed -i "s/- Lost appears/- Lost appears | Lost/" plan.txt +sed -i "s/- People vanish/- People vanish | Specter/" plan.txt +hg commit -m "Apply people to scenes" +# let’s mark this for later use +hg book splitchanges +# and evolve to get rid of the obsoletes +hg evolve --any +hg log -G +cd .. +#+END_SRC + +You can see the additional commit sticking out. We want to get the history easy to follow, so we just graft the last last change atop the split changes. + +/note: We seem to have the workdir on the new changeset instead of on the one we did before the evolve. I assume that’s a bug to fix./ + +#+BEGIN_SRC sh :exports both :results output verbatim +cd testmy +hg up splitchanges +hg graft -O tip +hg log -G +cd .. +#+END_SRC + +That’s it. All that’s left is fixing the plan, but that’s left for the reader :)