# HG changeset patch # User Pierre-Yves David # Date 1574078696 -3600 # Node ID 721b35f4341c668f5e8a71e64e0ef93c69cdc1e7 # Parent b01708eae5d0aa1d886eae30470bd412bc096f38# Parent 4941bb6d179c8b208def5116e93e101509ebfc75 branching: merge with stable diff -r b01708eae5d0 -r 721b35f4341c .gitlab-ci.yml --- a/.gitlab-ci.yml Mon Nov 18 13:01:38 2019 +0100 +++ b/.gitlab-ci.yml Mon Nov 18 13:04:56 2019 +0100 @@ -6,39 +6,27 @@ tests-py2-cext: image: octobus/ci-py2-hgext3rd script: - - echo $PWD - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` - - hg clone https://mirror.octobus.net/hg/ /tmp/mercurial-clone-`hg log -r . -T "{node}"` --config share.pool=/tmp/ - - hg -R /tmp/mercurial-clone-`hg log -r . -T "{node}"` update `hg log -r . -T '{branch}'` - - (cd tests; /tmp/mercurial-clone-`hg log -r . -T "{node}"`/tests/run-tests.py) - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` + - hg pull -R /ci/repos/mercurial/ + - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'` + - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always) tests-py2-pure: image: octobus/ci-py2-hgext3rd script: - - echo $PWD - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` - - hg clone https://mirror.octobus.net/hg/ /tmp/mercurial-clone-`hg log -r . -T "{node}"` --config share.pool=/tmp/ - - hg -R /tmp/mercurial-clone-`hg log -r . -T "{node}"` update `hg log -r . -T '{branch}'` - - (cd tests; /tmp/mercurial-clone-`hg log -r . -T "{node}"`/tests/run-tests.py --pure) - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` + - hg pull -R /ci/repos/mercurial/ + - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'` + - (cd tests; /ci/repos/mercurial/tests/run-tests.py --color=always --pure) tests-py3-cext: image: octobus/ci-py3-hgext3rd script: - - echo $PWD - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` - - hg clone https://mirror.octobus.net/hg/ /tmp/mercurial-clone-`hg log -r . -T "{node}"` --config share.pool=/tmp/ - - hg -R /tmp/mercurial-clone-`hg log -r . -T "{node}"` update `hg log -r . -T '{branch}'` - - (cd tests; python3 /tmp/mercurial-clone-`hg log -r . -T "{node}"`/tests/run-tests.py) - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` + - hg pull -R /ci/repos/mercurial/ + - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'` + - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always) tests-py3-pure: image: octobus/ci-py3-hgext3rd script: - - echo $PWD - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` - - hg clone https://mirror.octobus.net/hg/ /tmp/mercurial-clone-`hg log -r . -T "{node}"` --config share.pool=/tmp/ - - hg -R /tmp/mercurial-clone-`hg log -r . -T "{node}"` update `hg log -r . -T '{branch}'` - - (cd tests; python3 /tmp/mercurial-clone-`hg log -r . -T "{node}"`/tests/run-tests.py --pure) - - rm -rf /tmp/mercurial-clone-`hg log -r . -T "{node}"` + - hg pull -R /ci/repos/mercurial/ + - hg -R /ci/repos/mercurial/ update `hg log -r . -T '{branch}'` + - (cd tests; python3 /ci/repos/mercurial/tests/run-tests.py --color=always --pure) diff -r b01708eae5d0 -r 721b35f4341c CHANGELOG --- a/CHANGELOG Mon Nov 18 13:01:38 2019 +0100 +++ b/CHANGELOG Mon Nov 18 13:04:56 2019 +0100 @@ -15,6 +15,13 @@ * pick: don't create any successors when there were no changes (issue6093), * metaedit: don't change commit date by default (issue5994), + * rewind: preserve date + * py3: fix setup.py --version + * py3: fix documentation generation + * debian: allow to build with python 3 + * topic: add more options to command synopsis string + * evolve: use more often seen metavariables in command synopsis strings + * documentation: update text and add missing figures 9.2.1 -- 2019-10-05 ------------------- diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg01-ab.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg01-ab.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,52 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:f649 + + + +0->1 + + + + + +T0 +public + + + +T0->0 + + + + + +T1 +draft + + + +T1->1 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg02-b.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg02-b.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,83 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:f649 + + + +0->1 + + + + + +2 + +2:96d8 + + + +0->2 + + + + + +3 + +3:522d + + + +0->3 + + + + + +1->2 + + + + + +2->3 + + + + + +T12 +obsolete (and hidden) + + + +T12->1 + + + + + +T12->2 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg03.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg03.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,60 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:f649 + + + +0->1 + + + + + +2 + +2:522d + + + +0->2 + + + + + +1->2 + + + + + +T1 +obsolete (and hidden) +after the push + + + +T1->1 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg04-a.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg04-a.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,95 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:f649 + + + +0->1 + + + + + +2 + +2:522d + + + +0->2 + + + + + +3 + +3:e42b + + + +0->3 + + + + + +4 + +4:7b49 + + + +0->4 + + + + + +1->2 + + + + + +2->3 + + + + + +3->4 + + + + + +T3 +not in the other repo + + + +T3->3 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg04-b.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg04-b.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,95 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:f649 + + + +0->1 + + + + + +2 + +2:96d8 + + + +0->2 + + + + + +3 + +3:522d + + + +0->3 + + + + + +4 + +4:7b49 + + + +0->4 + + + + + +1->2 + + + + + +2->3 + + + + + +3->4 + + + + + +T2 +not in the other repo + + + +T2->2 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg05.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg05.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,41 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +T1 +only the final version + + + +T1->1 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg06.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg06.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,60 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:4e96 + + + +1->2 + + + + + +3 + +3:3363 + + + +1->3 + + + + + +2->3 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg07-a.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg07-a.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,108 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:4e96 + + + +1->2 + + + + + +3 + +3:3363 + + + +1->3 + + + + + +4 + +4:c7ff + + + +1->4 + + + + + +5 + +5:1bb4 + + + +1->5 + + + + + +6 + +6:9d21 + + + +1->6 + + + + + +2->3 + + + + + +4->5 + + + + + +5->6 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg07-b.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg07-b.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,42 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:9d21 + + + +1->2 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg08-a.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg08-a.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,126 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:4e96 + + + +1->2 + + + + + +3 + +3:3363 + + + +1->3 + + + + + +4 + +4:c7ff + + + +1->4 + + + + + +5 + +5:1bb4 + + + +1->5 + + + + + +6 + +6:9d21 + + + +1->6 + + + + + +2->3 + + + + + +7 + +7:dd15 + + + +3->7 + + + + + +4->5 + + + + + +5->6 + + + + + +6->7 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg08-b.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg08-b.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,54 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:9d21 + + + +1->2 + + + + + +3 + +3:dd15 + + + +2->3 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg09.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg09.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,130 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:9d21 + + + +1->2 + + + + + +3 + +3:dd15 + + + +2->3 + + + + + +4 + +4:b2be + + + +3->4 + + + + + +5 + +5:541f + + + +3->5 + + + + + +6 + +6:e3a5 + + + +3->6 + + + + + +4->5 + + + + + +4->6 + + + + + +T5 +working dir + + + +T5->5 + + + + + +T56 +content-divergent + + + +T56->5 + + + + + +T56->6 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/figures/figure-sg10.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/figures/figure-sg10.svg Mon Nov 18 13:04:56 2019 +0100 @@ -0,0 +1,138 @@ + + + + + + +Mercurial graph + + +0 + +0:0dc9 + + + +1 + +1:7b49 + + + +0->1 + + + + + +2 + +2:9d21 + + + +1->2 + + + + + +3 + +3:dd15 + + + +2->3 + + + + + +4 + +4:b2be + + + +3->4 + + + + + +5 + +5:541f + + + +3->5 + + + + + +6 + +6:e3a5 + + + +3->6 + + + + + +7 + +7:aa82 + + + +3->7 + + + + + +4->5 + + + + + +4->6 + + + + + +5->7 + + + + + +6->7 + + + + + +T7 +final, single +successor + + + +T7->7 + + + + + diff -r b01708eae5d0 -r 721b35f4341c docs/sharing.rst --- a/docs/sharing.rst Mon Nov 18 13:01:38 2019 +0100 +++ b/docs/sharing.rst Mon Nov 18 13:04:56 2019 +0100 @@ -160,12 +160,18 @@ At this point, ``dev-repo`` and ``test-repo`` have the same changesets in the same phases: - [figure SG01: rev 0:0dc9 public, rev 1:f649 draft, same on both repos] +.. figure:: figures/figure-sg01-ab.svg + + Figure 1 a: ``dev-repo`` has rev 0:0dc9 public, rev 1:f649 draft + +.. figure:: figures/figure-sg01-ab.svg + + Figure 1 b: the same exact picture in ``test-repo`` (You may notice a change in notation from the user guide: now changesets are labelled with their revision number and the first four digits of the 40-digit hexadecimal changeset ID. Mercurial revision -numbers are never stable when working across repositories, especially +numbers are not consistent when working across repositories, especially when obsolescence is involved. We'll see why shortly.) Now let's switch to ``test-repo`` to test our change:: @@ -181,16 +187,31 @@ punctuation and capitalization (oops). Let's amend our preliminary fix (and fix the lame commit message while we're at it):: + $ echo 'Fix fix fix' > file1 + $ hg amend -m 'fix bug 37' + +For the sake of illustrating how obsolete changesets are not exchanged, let's +amend again:: + $ echo 'Fix fix fix.' > file1 $ hg amend -m 'fix bug 37' +Note: some time ago, evolve used to create temporary amend commits. Here, +amending twice in a row is reminiscent of that behaviour that you may have seen +in older tutorials. + Now we're in a funny intermediate state (figure 2): revision 1:f649 is -obsolete in ``test-repo``, having been replaced by revision 3:60ff -(revision 2:2a03 is another one of those temporary amend commits that -we saw in the user guide)—but ``dev-repo`` knows nothing of these -recent developments. +obsolete in ``test-repo``, having been replaced by revision 2:96d8 and then by +3:522d—but ``dev-repo`` knows nothing of these recent developments. + +.. figure:: figures/figure-sg01-ab.svg - [figure SG02: test-repo has rev 0:0dc9 public, rev 1:f649, 2:2a03 obsolete, rev 3:60ff draft; dev-repo same as in SG01] + Figure 2 a: ``dev-repo`` same as in Figure 01 a + +.. figure:: figures/figure-sg02-b.svg + + Figure 2 b: ``test-repo`` has rev 0:0dc9 public, revs 1:f649 and 2:96d8 + obsolete, rev 3:522d draft Let's resynchronize:: @@ -198,15 +219,22 @@ $ hg pull -u [...] added 1 changesets with 1 changes to 1 files (+1 heads) + 2 new obsolescence markers + obsoleted 1 changesets + new changesets 522d503432a2 (1 drafts) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + updated to "522d503432a2: fix bug 37" + 1 other heads for branch "default" As seen in figure 3, this transfers the new changeset *and* the obsolescence marker for revision 1. However, it does *not* transfer -the temporary amend commit, because it is hidden. Push and pull -transfer obsolescence markers between repositories, but they do not -transfer hidden changesets. +2:96d8, because it is hidden. Push and pull transfer obsolescence +markers between repositories, but they do not transfer hidden changesets. - [figure SG03: dev-repo grows new rev 2:60ff, marks 1:f649 obsolete] +.. figure:: figures/figure-sg03.svg + + Figure 3: ``dev-repo`` receives rev 2:522d, 1:f649 is now obsolete like in + ``test-repo`` Because of this deliberately incomplete synchronization, revision numbers in ``test-repo`` and ``dev-repo`` are no longer consistent. We @@ -220,16 +248,24 @@ less-than-perfect idea. We'll implement it locally in ``dev-repo`` and push to ``test-repo``:: + $ echo 'Fix, fix, and fix' > file1 + $ hg amend $ echo 'Fix, fix, and fix.' > file1 $ hg amend $ hg push -This time around, the temporary amend commit is in ``dev-repo``, and +This time around, the first amend commit stays in ``dev-repo``, and it is not transferred to ``test-repo``—the same as before, just in the opposite direction. Figure 4 shows the two repositories after amending in ``dev-repo`` and pushing to ``test-repo``. - [figure SG04: each repo has one temporary amend commit, but they're different in each one] +.. figure:: figures/figure-sg04-a.svg + + Figure 4 a: in ``dev-repo`` the extra amend commit is 3:e42b + +.. figure:: figures/figure-sg04-b.svg + + Figure 4 b: and in ``test-repo`` it is 2:96d8 Let's hop over to ``test-repo`` to test the more elegant fix:: @@ -243,8 +279,9 @@ $ hg push [...] added 1 changesets with 1 changes to 1 files + 4 new obsolescence markers -Note that only one changeset—the final version, after two +Note that only one changeset—the final version, after all the amendments—was actually pushed. Again, Mercurial doesn't transfer hidden changesets on push and pull. @@ -254,12 +291,14 @@ ``dev-repo`` or ``test-repo``. Neither of our missteps nor our amendments are publicly visible, just the final, beautifully polished changeset: - [figure SG05: public repo with rev 0:0dc9, 1:de61, both public] +.. figure:: figures/figure-sg05.svg + + Figure 5: in ``public`` repo with revs 0:0dc9 and 1:7b49, both public 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`` has been out-of-the-loop; -changeset de61 is still *draft* there. If we're not careful, we might +changeset 7b49 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 pushing up to ``dev-repo``:: @@ -381,11 +420,16 @@ $ hg push [...] added 1 changesets with 1 changes to 1 files (+1 heads) + 1 new obsolescence markers + obsoleted 1 changesets updating bookmark bug15 Figure 6 shows the state of the ``review`` repository at this point. - [figure SG06: rev 2:fn1e is Alice's obsolete v1, rev 3:cbdf is her v2; both children of rev 1:de61] +.. figure:: figures/figure-sg06.svg + + Figure 6: rev 2:4e96 is Alice's obsolete v1, rev 3:3363 is her v2; both + children of rev 1:7b49 After a busy morning of bug fixing, Alice stops for lunch. Let's see what Bob has been up to. @@ -401,7 +445,7 @@ $ cd ../bob $ echo 'stuff' > file1 $ hg bookmark featureX - $ hg commit -u bob -m 'implement feature X (v1)' # rev 4:1636 + $ hg commit -u bob -m 'implement feature X (v1)' # rev 4:c7ff $ hg push -B featureX [...] added 1 changesets with 1 changes to 1 files (+1 heads) @@ -411,17 +455,19 @@ bit, amends, and submits the resulting changeset for review:: $ echo 'do stuff' > file1 - $ hg amend -m 'implement feature X (v2)' # rev 5:0eb7 + $ hg amend -m 'implement feature X (v2)' # rev 5:1bb4 $ hg push [...] added 1 changesets with 1 changes to 1 files (+1 heads) + 1 new obsolescence markers + obsoleted 1 changesets updating bookmark featureX Unfortunately, that still doesn't pass muster. Bob's reviewer insists on proper capitalization and punctuation. :: $ echo 'Do stuff.' > file1 - $ hg amend -m 'implement feature X (v3)' # rev 6:540b + $ hg amend -m 'implement feature X (v3)' # rev 6:9d21 On the bright side, the second review said, "Go ahead and publish once you fix that." So Bob immediately publishes his third attempt:: @@ -429,22 +475,33 @@ $ hg push ../public [...] added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers It's not enough just to update ``public``, though! Other people also use the ``review`` repository, and right now it doesn't have Bob's -latest amendment ("v3", revision 6:540b), nor does it know that the -predecessor of that changeset ("v2", revision 5:0eb7) is obsolete. Thus, +latest amendment ("v3", revision 6:9d21), nor does it know that the +predecessor of that changeset ("v2", revision 5:1bb4) is obsolete. Thus, Bob pushes to ``review`` as well:: $ hg push ../review [...] added 1 changesets with 1 changes to 1 files (+1 heads) + 1 new obsolescence markers + obsoleted 1 changesets updating bookmark featureX Figure 7 shows the result of Bob's work in both ``review`` and ``public``. - [figure SG07: review includes Alice's draft work on bug 15, as well as Bob's v1, v2, and v3 changes for feature X: v1 and v2 obsolete, v3 public. public contains only the final, public implementation of feature X] +.. figure:: figures/figure-sg07-a.svg + + Figure 7 a: ``review`` includes Alice's draft work on bug 15, as well as + Bob's v1, v2, and v3 changes for feature X: v1 and v2 obsolete, v3 public + +.. figure:: figures/figure-sg07-b.svg + + Figure 7 b: ``public`` contains only the final, public implementation of + feature X Incidentally, it's important that Bob push to ``public`` *before* ``review``. If he pushed to ``review`` first, then revision 6:540b @@ -463,9 +520,9 @@ $ hg push ../public [...] - remote has heads on branch 'default' that are not known locally: 540ba8f317e6 - abort: push creates new remote head cbdfbd5a5db2! - (pull and merge or see "hg help push" for details about pushing new heads) + remote has heads on branch 'default' that are not known locally: 9d21d673314a + abort: push creates new remote head 3363442626b3 with bookmark 'bug15'! + (pull and merge or see 'hg help push' for details about pushing new heads) Oops! Bob has won the race to push first to ``public``. So Alice needs to integrate with Bob: let's pull his changeset(s) and see what the @@ -476,9 +533,9 @@ added 1 changesets with 1 changes to 1 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) $ hg log -G -q -r 'head()' --template '{rev}:{node|short} ({author})\n' - o 5:540ba8f317e6 (bob) + o 4:9d21d673314a (bob) | - | @ 4:cbdfbd5a5db2 (alice) + | @ 3:3363442626b3 (alice) |/ We'll assume Alice and Bob are perfectly comfortable with rebasing @@ -486,19 +543,29 @@ form of ``amend``.) So Alice rebases her changeset on top of Bob's and publishes the result:: - $ hg rebase -d 5 + $ hg rebase -d 4 $ hg push ../public [...] added 1 changesets with 1 changes to 1 files + 2 new obsolescence markers $ hg push ../review [...] - added 1 changesets with 0 changes to 0 files + added 1 changesets with 0 changes to 1 files + 1 new obsolescence markers + obsoleted 1 changesets updating bookmark bug15 The result, in both ``review`` and ``public`` repositories, is shown in figure 8. - [figure SG08: review shows v1 and v2 of Alice's fix, then v1, v2, v3 of Bob's feature, finally Alice's fix rebased onto Bob's. public just shows the final public version of each changeset] +.. figure:: figures/figure-sg08-a.svg + + Figure 8 a: ``review`` shows v1 and v2 of Alice's fix, then v1, v2, v3 of + Bob's feature, finally Alice's fix rebased onto Bob's + +.. figure:: figures/figure-sg08-b.svg + + Figure 8 b: ``public`` just shows the final public version of each changeset Getting into trouble with shared mutable history ------------------------------------------------ @@ -567,7 +634,7 @@ $ cd bob $ echo 'pretty good fix' >> file1 - $ hg commit -u bob -m 'fix bug 24 (v1)' # rev 4:2fe6 + $ hg commit -u bob -m 'fix bug 24 (v1)' # rev 4:b2be Since Alice and Bob are now in cowboy mode, Alice pulls Bob's draft changeset and amends it herself. :: @@ -584,36 +651,42 @@ $ cd ../bob $ echo 'better fix (bob)' >> file1 - $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' # rev 6:a360 + $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' # rev 5:541f At this point, the divergence exists, but only in theory: Bob's -original changeset, 4:2fe6, is obsolete and has two successors. But +original changeset, 4:b2be, is obsolete and has two successors. But those successors are in different repositories, so the trouble is not visible to anyone yet. It will be as soon as Bob pulls from Alice's repository (or vice-versa). :: $ hg pull ../alice [...] - added 1 changesets with 1 changes to 2 files (+1 heads) + added 1 changesets with 1 changes to 1 files (+1 heads) + 1 new obsolescence markers + 2 new content-divergent changesets + new changesets e3a586fd2377 (1 drafts) (run 'hg heads' to see heads, 'hg merge' to merge) - 2 new content-divergent changesets Figure 9 shows the situation in Bob's repository. - [figure SG09: Bob's repo with 2 heads for the 2 content-divergent changesets, 6:a360 and 7:e3f9; wc is at 6:a360; both are successors of obsolete 4:2fe6, hence divergence] +.. figure:: figures/figure-sg09.svg + + Figure 9: Bob's repo with 2 heads for the 2 content-divergent changesets, + 5:541f and 6:e3a5; wc is at 5:541f; both are successors of obsolete 4:b2be, + hence divergence Now we need to get out of trouble. As usual, the answer is to evolve history. :: $ HGMERGE=internal:other hg evolve - merge:[6] fix bug 24 (v2 by bob) - with: [7] fix bug 24 (v2 by alice) + merge:[5] fix bug 24 (v2 by bob) + with: [6] fix bug 24 (v2 by alice) base: [4] fix bug 24 (v1) 0 files updated, 1 files merged, 0 files removed, 0 files unresolved Figure 10 shows how Bob's repository looks now. - [figure SG10: only one visible head, 9:5ad6, successor to hidden 6:a360 and 7:e3f9] + [figure SG10: only one visible head, 7:aa82, successor to hidden 5:541f and 6:e3a5] We carefully dodged a merge conflict by specifying a merge tool (``internal:other``) that will take Alice's changes over Bob's. (You diff -r b01708eae5d0 -r 721b35f4341c hgext3rd/evolve/__init__.py diff -r b01708eae5d0 -r 721b35f4341c hgext3rd/evolve/cmdrewrite.py diff -r b01708eae5d0 -r 721b35f4341c hgext3rd/evolve/compat.py diff -r b01708eae5d0 -r 721b35f4341c hgext3rd/topic/compat.py diff -r b01708eae5d0 -r 721b35f4341c tests/test-sharing.t --- a/tests/test-sharing.t Mon Nov 18 13:01:38 2019 +0100 +++ b/tests/test-sharing.t Mon Nov 18 13:04:56 2019 +0100 @@ -5,7 +5,7 @@ $ cat >> $HGRCPATH < [alias] - > shortlog = log --template '{rev}:{node|short} {phase} {desc|firstline}\n' + > shortlog = log --template '{rev}:{node|shortest} {phase} {desc|firstline}\n' > [extensions] > rebase = > EOF @@ -57,24 +57,38 @@ $ hg push -q ../test-repo Figure SG01 (roughly) - $ hg shortlog -G - @ 1:f6490818a721 draft prelim change + $ hg -R ../dev-repo shortlog -G + @ 1:f649 draft prelim change | - o 0:0dc9c9f6ab91 public create new project + o 0:0dc9 public create new project + + $ hg -R ../test-repo shortlog -G + o 1:f649 draft prelim change + | + @ 0:0dc9 public create new project Now let's switch to test-repo to test our change and amend:: $ cd ../test-repo $ hg update -q + $ echo 'Fix fix fix' > file1 + $ hg amend -m'fix bug 37' $ echo 'Fix fix fix.' > file1 $ hg amend -m'fix bug 37' Figure SG02 - $ hg shortlog --hidden -G - @ 2:60ffde5765c5 draft fix bug 37 + $ hg -R ../dev-repo shortlog --hidden -G + @ 1:f649 draft prelim change | - | x 1:f6490818a721 draft prelim change + o 0:0dc9 public create new project + + $ hg -R ../test-repo shortlog --hidden -G + @ 3:522d draft fix bug 37 + | + | x 2:96d8 draft fix bug 37 |/ - o 0:0dc9c9f6ab91 public create new project + | x 1:f649 draft prelim change + |/ + o 0:0dc9 public create new project Pull into dev-repo: obsolescence markers are transferred, but not the new obsolete changeset. @@ -86,50 +100,56 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) - 1 new obsolescence markers + 2 new obsolescence markers obsoleted 1 changesets - new changesets 60ffde5765c5 (1 drafts) + new changesets 522d503432a2 (1 drafts) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - updated to "60ffde5765c5: fix bug 37" + updated to "522d503432a2: fix bug 37" 1 other heads for branch "default" Figure SG03 - $ hg shortlog --hidden -G - @ 2:60ffde5765c5 draft fix bug 37 + $ hg -R ../dev-repo shortlog --hidden -G + @ 2:522d draft fix bug 37 | - | x 1:f6490818a721 draft prelim change + | x 1:f649 draft prelim change |/ - o 0:0dc9c9f6ab91 public create new project + o 0:0dc9 public create new project Amend again in dev-repo + $ echo 'Fix, fix, and fix' > file1 + $ hg amend $ echo 'Fix, fix, and fix.' > file1 $ hg amend $ hg push -q Figure SG04 (dev-repo) $ hg shortlog --hidden -G - @ 3:de6151c48e1c draft fix bug 37 + @ 4:7b49 draft fix bug 37 | - | x 2:60ffde5765c5 draft fix bug 37 + | x 3:e42b draft fix bug 37 |/ - | x 1:f6490818a721 draft prelim change + | x 2:522d draft fix bug 37 |/ - o 0:0dc9c9f6ab91 public create new project + | x 1:f649 draft prelim change + |/ + o 0:0dc9 public create new project Figure SG04 (test-repo) $ cd ../test-repo $ hg update 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - updated to "de6151c48e1c: fix bug 37" + updated to "7b49f864d655: fix bug 37" 1 other heads for branch "default" $ hg shortlog --hidden -G - @ 3:de6151c48e1c draft fix bug 37 + @ 4:7b49 draft fix bug 37 | - | x 2:60ffde5765c5 draft fix bug 37 + | x 3:522d draft fix bug 37 |/ - | x 1:f6490818a721 draft prelim change + | x 2:96d8 draft fix bug 37 |/ - o 0:0dc9c9f6ab91 public create new project + | x 1:f649 draft prelim change + |/ + o 0:0dc9 public create new project This bug fix is finished. We can push it to the public repository. $ hg push @@ -139,23 +159,23 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - 2 new obsolescence markers + 4 new obsolescence markers Now that the fix is public, we cannot amend it any more. $ hg amend -m 'fix bug 37' - abort: cannot amend public changesets: de6151c48e1c + abort: cannot amend public changesets: 7b49f864d655 (see 'hg help phases' for details) [255] Figure SG05 $ hg -R ../public shortlog -G - o 1:de6151c48e1c public fix bug 37 + o 1:7b49 public fix bug 37 | - o 0:0dc9c9f6ab91 public create new project + o 0:0dc9 public create new project Oops, still have draft changesets in dev-repo: push the phase change there. $ hg -R ../dev-repo shortlog -r 'draft()' - 3:de6151c48e1c draft fix bug 37 + 4:7b49 draft fix bug 37 $ hg push ../dev-repo pushing to ../dev-repo searching for changes @@ -195,7 +215,7 @@ added 1 changesets with 1 changes to 1 files exporting bookmark bug15 $ hg -R ../review bookmarks - bug15 2:f91e97234c2b + bug15 2:4e965c66c983 Alice receives code review, amends her fix, and goes out to lunch to await second review. @@ -212,15 +232,15 @@ obsoleted 1 changesets updating bookmark bug15 $ hg -R ../review bookmarks - bug15 3:cbdfbd5a5db2 + bug15 3:3363442626b3 Figure SG06: review repository after Alice pushes her amended changeset. $ hg --hidden -R ../review shortlog -G -r 1:: - o 3:cbdfbd5a5db2 draft fix bug 15 (v2) + o 3:3363 draft fix bug 15 (v2) | - | x 2:f91e97234c2b draft fix bug 15 (v1) + | x 2:4e96 draft fix bug 15 (v1) |/ - @ 1:de6151c48e1c public fix bug 37 + @ 1:7b49 public fix bug 37 | ~ @@ -232,15 +252,15 @@ $ hg push -B featureX pushing to $TESTTMP/review (glob) searching for changes - remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2 + remote has heads on branch 'default' that are not known locally: 3363442626b3 adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) exporting bookmark featureX $ hg -R ../review bookmarks - bug15 3:cbdfbd5a5db2 - featureX 4:193657d1e852 + bug15 3:3363442626b3 + featureX 4:c7ff98c7916f Bob receives first review, amends and pushes. $ echo 'do stuff' > file1 @@ -248,7 +268,7 @@ $ hg push pushing to $TESTTMP/review (glob) searching for changes - remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2 + remote has heads on branch 'default' that are not known locally: 3363442626b3 adding changesets adding manifests adding file changes @@ -274,7 +294,7 @@ $ hg push ../review pushing to ../review searching for changes - remote has heads on branch 'default' that are not known locally: cbdfbd5a5db2 + remote has heads on branch 'default' that are not known locally: 3363442626b3 adding changesets adding manifests adding file changes @@ -283,45 +303,28 @@ obsoleted 1 changesets updating bookmark featureX $ hg -R ../review bookmarks - bug15 3:cbdfbd5a5db2 - featureX 6:540ba8f317e6 + bug15 3:3363442626b3 + featureX 6:9d21d673314a Figure SG07: review and public repos after Bob implements feature X. $ hg --hidden -R ../review shortlog -G -r 1:: - o 6:540ba8f317e6 public implement feature X (v3) + o 6:9d21 public implement feature X (v3) | - | x 5:0eb74a7b6698 draft implement feature X (v2) + | x 5:1bb4 draft implement feature X (v2) |/ - | x 4:193657d1e852 draft implement feature X (v1) + | x 4:c7ff draft implement feature X (v1) |/ - | o 3:cbdfbd5a5db2 draft fix bug 15 (v2) + | o 3:3363 draft fix bug 15 (v2) |/ - | x 2:f91e97234c2b draft fix bug 15 (v1) + | x 2:4e96 draft fix bug 15 (v1) |/ - @ 1:de6151c48e1c public fix bug 37 + @ 1:7b49 public fix bug 37 | ~ $ hg --hidden -R ../public shortlog -G -r 1:: - o 2:540ba8f317e6 public implement feature X (v3) - | - o 1:de6151c48e1c public fix bug 37 + o 2:9d21 public implement feature X (v3) | - ~ - -How do things look in the review repo? - $ cd ../review - $ hg --hidden shortlog -G -r 1:: - o 6:540ba8f317e6 public implement feature X (v3) - | - | x 5:0eb74a7b6698 draft implement feature X (v2) - |/ - | x 4:193657d1e852 draft implement feature X (v1) - |/ - | o 3:cbdfbd5a5db2 draft fix bug 15 (v2) - |/ - | x 2:f91e97234c2b draft fix bug 15 (v1) - |/ - @ 1:de6151c48e1c public fix bug 37 + o 1:7b49 public fix bug 37 | ~ @@ -329,20 +332,20 @@ her change, so now she can publish it. $ cd ../alice $ hg --hidden shortlog -G -r 1:: - @ 3:cbdfbd5a5db2 draft fix bug 15 (v2) + @ 3:3363 draft fix bug 15 (v2) | - | x 2:f91e97234c2b draft fix bug 15 (v1) + | x 2:4e96 draft fix bug 15 (v1) |/ - o 1:de6151c48e1c public fix bug 37 + o 1:7b49 public fix bug 37 | ~ $ hg outgoing -q ../public - 3:cbdfbd5a5db2 + 3:3363442626b3 $ hg push ../public pushing to ../public searching for changes - remote has heads on branch 'default' that are not known locally: 540ba8f317e6 - abort: push creates new remote head cbdfbd5a5db2 with bookmark 'bug15'! + remote has heads on branch 'default' that are not known locally: 9d21d673314a + abort: push creates new remote head 3363442626b3 with bookmark 'bug15'! (pull and merge or see 'hg help push' for details about pushing new heads) [255] $ hg pull ../public @@ -353,30 +356,30 @@ adding file changes added 1 changesets with 1 changes to 1 files (+1 heads) 2 new obsolescence markers - new changesets 540ba8f317e6 + new changesets 9d21d673314a (run 'hg heads' to see heads, 'hg merge' to merge) $ hg log -G -q -r 'head()' - o 4:540ba8f317e6 + o 4:9d21d673314a | ~ - @ 3:cbdfbd5a5db2 + @ 3:3363442626b3 | ~ $ hg --hidden shortlog -G -r 1:: - o 4:540ba8f317e6 public implement feature X (v3) + o 4:9d21 public implement feature X (v3) | - | @ 3:cbdfbd5a5db2 draft fix bug 15 (v2) + | @ 3:3363 draft fix bug 15 (v2) |/ - | x 2:f91e97234c2b draft fix bug 15 (v1) + | x 2:4e96 draft fix bug 15 (v1) |/ - o 1:de6151c48e1c public fix bug 37 + o 1:7b49 public fix bug 37 | ~ Alice rebases her draft changeset on top of Bob's public changeset and publishes the result. - $ hg rebase -d 5 - rebasing 3:cbdfbd5a5db2 "fix bug 15 (v2)" (bug15) + $ hg rebase -d 4 + rebasing 3:3363442626b3 "fix bug 15 (v2)" (bug15) $ hg push ../public pushing to ../public searching for changes @@ -398,27 +401,27 @@ Figure SG08: review and public changesets after Alice pushes. $ hg --hidden -R ../review shortlog -G -r 1:: - o 7:a06ec1bf97bd public fix bug 15 (v2) + o 7:dd15 public fix bug 15 (v2) | - o 6:540ba8f317e6 public implement feature X (v3) + o 6:9d21 public implement feature X (v3) | - | x 5:0eb74a7b6698 draft implement feature X (v2) + | x 5:1bb4 draft implement feature X (v2) |/ - | x 4:193657d1e852 draft implement feature X (v1) + | x 4:c7ff draft implement feature X (v1) |/ - | x 3:cbdfbd5a5db2 draft fix bug 15 (v2) + | x 3:3363 draft fix bug 15 (v2) |/ - | x 2:f91e97234c2b draft fix bug 15 (v1) + | x 2:4e96 draft fix bug 15 (v1) |/ - @ 1:de6151c48e1c public fix bug 37 + @ 1:7b49 public fix bug 37 | ~ $ hg --hidden -R ../public shortlog -G -r 1:: - o 3:a06ec1bf97bd public fix bug 15 (v2) + o 3:dd15 public fix bug 15 (v2) | - o 2:540ba8f317e6 public implement feature X (v3) + o 2:9d21 public implement feature X (v3) | - o 1:de6151c48e1c public fix bug 37 + o 1:7b49 public fix bug 37 | ~ $ cd .. @@ -445,7 +448,7 @@ $ echo 'pretty good fix' >> file1 $ hg commit -u bob -m 'fix bug 24 (v1)' $ hg shortlog -r . - 4:2fe6c4bd32d0 draft fix bug 24 (v1) + 4:b2be draft fix bug 24 (v1) Alice pulls Bob's draft changeset and amends it herself. :: @@ -457,7 +460,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - new changesets 2fe6c4bd32d0 (1 drafts) + new changesets b2be254b3b9f (1 drafts) 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)' @@ -468,11 +471,11 @@ $ echo 'better fix (bob)' >> file1 $ hg amend -u bob -m 'fix bug 24 (v2 by bob)' $ hg --hidden shortlog -G -r 3:: - @ 5:a360947f6faf draft fix bug 24 (v2 by bob) + @ 5:541f draft fix bug 24 (v2 by bob) | - | x 4:2fe6c4bd32d0 draft fix bug 24 (v1) + | x 4:b2be draft fix bug 24 (v1) |/ - o 3:a06ec1bf97bd public fix bug 15 (v2) + o 3:dd15 public fix bug 15 (v2) | ~ @@ -486,23 +489,23 @@ added 1 changesets with 1 changes to 1 files (+1 heads) 1 new obsolescence markers 2 new content-divergent changesets - new changesets e3f99ce9d9cd (1 drafts) + new changesets e3a586fd2377 (1 drafts) (run 'hg heads' to see heads, 'hg merge' to merge) Figure SG09: multiple heads! divergence! oh my! $ hg --hidden shortlog -G -r 3:: - * 6:e3f99ce9d9cd draft fix bug 24 (v2 by alice) + * 6:e3a5 draft fix bug 24 (v2 by alice) | - | @ 5:a360947f6faf draft fix bug 24 (v2 by bob) + | @ 5:541f draft fix bug 24 (v2 by bob) |/ - | x 4:2fe6c4bd32d0 draft fix bug 24 (v1) + | x 4:b2be draft fix bug 24 (v1) |/ - o 3:a06ec1bf97bd public fix bug 15 (v2) + o 3:dd15 public fix bug 15 (v2) | ~ - $ hg --hidden shortlog -r 'successors(2fe6)' - 5:a360947f6faf draft fix bug 24 (v2 by bob) - 6:e3f99ce9d9cd draft fix bug 24 (v2 by alice) + $ hg --hidden shortlog -r 'successors(b2be)' + 5:541f draft fix bug 24 (v2 by bob) + 6:e3a5 draft fix bug 24 (v2 by alice) Use evolve to fix the divergence. $ cat > editor.sh <