tests/test-sharing.t
branchstable
changeset 1265 14f91037d2f6
parent 1263 eb0a1d1d499b
child 1356 aff6bc2a6b2d
--- a/tests/test-sharing.t	Fri Jun 20 08:19:04 2014 -0400
+++ b/tests/test-sharing.t	Tue Apr 14 12:58:13 2015 -0400
@@ -424,3 +424,121 @@
   |
   o  1:de6151c48e1c  public  fix bug 37
   |
+  $ cd ..
+
+Setup for "cowboy mode" shared mutable history (to illustrate divergent
+and bumped changesets).
+  $ rm -rf review alice bob
+  $ hg clone public alice
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg clone public bob
+  updating to branch default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat >> alice/.hg/hgrc <<EOF
+  > [phases]
+  > publish = false
+  > EOF
+  $ cp alice/.hg/hgrc bob/.hg/hgrc
+
+Now we'll have Bob commit a bug fix that could still be improved::
+
+  $ cd bob
+  $ echo 'pretty good fix' >> file1
+  $ hg commit -u bob -m 'fix bug 24 (v1)'
+  $ hg shortlog -r .
+  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
+
+Since Alice and Bob are now in cowboy mode, Alice pulls Bob's draft
+changeset and amends it herself. ::
+
+  $ cd ../alice
+  $ hg pull -u ../bob
+  pulling from ../bob
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  pull obsolescence markers
+  0 obsolescence markers added
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo 'better fix (alice)' >> file1
+  $ hg amend -u alice -m 'fix bug 24 (v2 by alice)'
+
+Bob implements a better fix of his own::
+
+  $ cd ../bob
+  $ echo 'better fix (bob)' >> file1
+  $ hg amend -u bob -m 'fix bug 24 (v2 by bob)'
+  $ hg --hidden shortlog -G -r 3::
+  @  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
+  |
+  | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
+  | |
+  | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
+  |/
+  o  3:a06ec1bf97bd  public  fix bug 15 (v2)
+  |
+
+Bob discovers the divergence.
+  $ hg pull ../alice
+  pulling from ../alice
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files (+1 heads)
+  pull obsolescence markers
+  2 obsolescence markers added
+  (run 'hg heads' to see heads, 'hg merge' to merge)
+  2 new divergent changesets
+
+Figure SG09: multiple heads! divergence! oh my!
+  $ hg --hidden shortlog -G -r 3::
+  o  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
+  |
+  | @  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
+  |/
+  | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
+  | |
+  | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
+  |/
+  o  3:a06ec1bf97bd  public  fix bug 15 (v2)
+  |
+  $ hg --hidden shortlog -r 'successors(2fe6)'
+  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
+  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
+
+Use evolve to fix the divergence.
+  $ HGMERGE=internal:other hg evolve
+  merge:[6] fix bug 24 (v2 by bob)
+  with: [7] fix bug 24 (v2 by alice)
+  base: [4] fix bug 24 (v1)
+  0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  working directory is now at 5ad6037c046c
+  $ hg log -q -r 'divergent()'
+
+Figure SG10: Bob's repository after fixing divergence.
+  $ hg --hidden shortlog -G -r 3::
+  @  9:5ad6037c046c  draft  fix bug 24 (v2 by bob)
+  |
+  | x  8:bcfc9a755ac3  draft  temporary amend commit for a360947f6faf
+  | |
+  +---x  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
+  | |
+  | x  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
+  |/
+  | x  5:3466c7f5a149  draft  temporary amend commit for 2fe6c4bd32d0
+  | |
+  | x  4:2fe6c4bd32d0  draft  fix bug 24 (v1)
+  |/
+  o  3:a06ec1bf97bd  public  fix bug 15 (v2)
+  |
+  $ hg --hidden shortlog -r 'precursors(9)'
+  6:a360947f6faf  draft  fix bug 24 (v2 by bob)
+  7:e3f99ce9d9cd  draft  fix bug 24 (v2 by alice)
+  $ cat file1
+  Do stuff.
+  pretty good fix
+  better fix (alice)