changeset 1263:eb0a1d1d499b stable

docs: sharing guide: clarify end-game of "Example 2" - push to dev-repo, rather than pulling into it (consistent with how we work the multiple developer scenario later) - explicitly demonstrate that public changesets are immutable
author Greg Ward <greg@gerg.ca>
date Tue, 14 Apr 2015 12:55:04 -0400
parents eff1acc2511c
children 33ed6119a0be
files docs/sharing.rst tests/test-sharing.t
diffstat 2 files changed, 30 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/docs/sharing.rst	Sun Jun 15 21:17:09 2014 -0400
+++ b/docs/sharing.rst	Tue Apr 14 12:55:04 2015 -0400
@@ -258,19 +258,28 @@
 
 There is one important step left to do. Because we pushed from
 ``test-repo`` to ``public``, the pushed changeset is in *public* phase
-in those two repositories. But ``dev-repo`` knows nothing of this:
-that changeset is still *draft* there. If we're not careful, we might
+in those two repositories. But ``dev-repo`` has been out-of-the-loop;
+changeset de61 is still *draft* there. If we're not careful, we might
 mutate history in ``dev-repo``, obsoleting a changeset that is already
-public. Let's avoid that situation for now by pulling from
-``test-repo`` down to ``dev-repo``::
+public. Let's avoid that situation for now by pushing up to
+``dev-repo``::
 
-  $ cd ../dev-repo
-  $ hg pull -u
-  [...]
+  $ hg push ../dev-repo
+  pushing to ../dev-repo
+  searching for changes
   no changes found
 
-Even though no *changesets* were pulled, Mercurial still pulled
-obsolescence markers from ``test-repo``.
+Even though no *changesets* were pushed, Mercurial still pushed
+obsolescence markers and phase changes to ``dev-repo``.
+
+A final note: since this fix is now *public*, it is immutable. It's no
+longer possible to amend it::
+
+  $ hg amend -m 'fix bug 37'
+  abort: cannot amend public changesets
+
+This is, after all, the whole point of Mercurial's phases: to prevent
+rewriting history that has already been published.
 
 Sharing with multiple developers: code review
 ---------------------------------------------
--- a/tests/test-sharing.t	Sun Jun 15 21:17:09 2014 -0400
+++ b/tests/test-sharing.t	Tue Apr 14 12:55:04 2015 -0400
@@ -143,23 +143,28 @@
   pushing 4 obsolescence markers (* bytes) (glob)
   4 obsolescence markers added
 
+Now that the fix is public, we cannot amend it any more.
+  $ hg amend -m 'fix bug 37'
+  abort: cannot amend public changesets
+  [255]
+
 Figure SG05
   $ hg -R ../public shortlog -G
   o  1:de6151c48e1c  public  fix bug 37
   |
   o  0:0dc9c9f6ab91  public  create new project
   
-Oops, still have draft changesets in dev-repo.
-  $ cd ../dev-repo
-  $ hg shortlog -r 'draft()'
+Oops, still have draft changesets in dev-repo: push the phase change there.
+  $ hg -R ../dev-repo shortlog -r 'draft()'
   4:de6151c48e1c  draft  fix bug 37
-  $ hg pull -u
-  pulling from $TESTTMP/test-repo
+  $ hg push ../dev-repo
+  pushing to ../dev-repo
   searching for changes
   no changes found
-  pull obsolescence markers
+  pushing 4 obsolescence markers (* bytes) (glob)
   0 obsolescence markers added
-  $ hg shortlog -r 'draft()'
+  [1]
+  $ hg -R ../dev-repo shortlog -r 'draft()'
 
 Sharing with multiple developers: code review