Mercurial Evolve Test

(Arne Babenhauserheide)
2013-01-10: added phases: safe amending.

added phases: safe amending.

diff --git a/Readme.org b/Readme.org
--- a/Readme.org
+++ b/Readme.org
@@ -109,7 +109,7 @@ cd ..
 
 Now my file contains the wishes of the players as well as the places.
 
-We pull the changes into the repo of another game master with whom we plan this game. 
+We pull the changes into the repo of another gamemaster with whom we plan this game. 
 
 #+BEGIN_SRC sh :exports both :results output verbatim :session test-hg-evolve
 hg -R testother pull -u testmy
@@ -184,6 +184,40 @@ hg -R testother log -G -r 1:
 
 And as you can see, everything looks nice again.
 
+** …safely
+
+/Publishing the changes into a public repo makes them immutable./
+
+Now imagine, that my co-gamemaster publishes his work. Mercurial will then store that his changes were published and warn us, if we try to change them.
+
+#+BEGIN_SRC sh :exports both :results output verbatim :session test-hg-evolve
+cd testother
+hg up > /dev/null
+echo "current phase"
+hg phase .
+hg push ../testpublic
+echo "phase after publishing"
+hg phase .
+cd ..
+#+END_SRC
+
+Now trying to amend history will fail (except if we first change the phase to draft with `hg phase --force --draft .`).
+
+#+BEGIN_SRC sh :exports both :results output verbatim :session test-hg-evolve
+cd testmy
+hg amend -m "change published history"
+# change to draft
+hg phase -fd .
+hg phase .
+# now we could amend, but that would defeat the point of this section, so we go to public again.
+hg phase -p .
+cd ..
+#+END_SRC
+
+Once I pull from that repo, the revisions which are in there will also switch phase to public in my repo. 
+
+So by pushing the changes into a publishing repo, you can get the Mercurial of all contributors to track which revisions are safe to change - and which are not. An alternative is using `hg phase -p REV`.
+
 ** Fold
 
 /Do multiple commits to create a patch, then fold them into one commit./