Mercurial > evolve
view tests/test-evolve-inmemory.t @ 5777:c5dfbbe4363d
evolve: when relocating, optionally first try to do it using in-memory merge
This patch adds a config option to let run evolve's relocation step
using in-memory merge. It is disabled by default. When the option is
on, the relocation is first attempted in memory. If that fails because
of merge conflicts, it retries that commit in the working copy.
There are a few reasons that I made it configurable. The most
important one is that the precommit hook won't trigger when using
in-memory merge. Another reason is that it lets us roll out the
feature slowly to our users at Google.
For now, we also update the working copy after creating the commit (in the
successful case, when there are no merge conflicts). The next patch will make it
so we don't do that update.
Because of the unnecessary working-copy update, this patch doesn't
provide any benefit on its own. Evolving 29 commits that each change
one line in the hg slows down from ~4.5s to ~4.8s when the config
option is on.
I've added `#testcases inmemory ondisk` to select `.t` files. Almost
all differences are because of the new "hit merge conflicts" message
and retrying the merge. There's also one difference in
`test-stabilize-order.t` caused by the different order of working copy
updates (we now update the working copy at the end).
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 15 Oct 2020 15:40:36 -0700 |
parents | 453ba695c3d4 |
children | 84affb254cdf |
line wrap: on
line source
Tests running `hg evolve` with in-memory merge. $ . $TESTDIR/testlib/common.sh $ cat >> $HGRCPATH <<EOF > [extensions] > evolve = > drawdag=$RUNTESTDIR/drawdag.py > [alias] > glog = log -G -T '{rev}:{node|short} {separate(" ", phase, tags)}\n{desc|firstline}' > [experimental] > evolution.in-memory = yes > EOF Test evolving a single orphan $ hg init single-orphan $ cd single-orphan $ hg debugdrawdag <<'EOS' > C # C/c = c\n > B2 | # B2/b = b2\n > | B # B/b = b\n > \ / # replace: B -> B2 > A > EOS 1 new orphan changesets $ hg evolve move:[3] C atop:[2] B2 $ hg glog o 4:52da76e91abb draft tip | C | x 3:bc77848cde3a draft C | | C o | 2:377a194b9b8a draft B2 | | B2 | x 1:830b6315076c draft B |/ B o 0:426bada5c675 draft A A $ hg cat -r tip b c b2 c $ cd .. Test that in-memory evolve works when there are conflicts and after continuing. $ hg init conflicts $ cd conflicts $ hg debugdrawdag <<'EOS' > E # E/e = e\n > | > D # D/b = d\n > | > C # C/c = c\n > B2 | # B2/b = b2\n > | B # B/b = b\n > \ / # replace: B -> B2 > A > EOS 3 new orphan changesets $ hg evolve move:[3] C atop:[2] B2 move:[4] D merging b hit merge conflicts; retrying merge in working copy merging b warning: conflicts while merging b! (edit, then use 'hg resolve --mark') unresolved merge conflicts (see 'hg help evolve.interrupted') [240] $ hg glog @ 6:52da76e91abb draft tip | C | * 5:eae7899dd92b draft E | | E | % 4:57e51f6a6d36 draft D | | D | x 3:bc77848cde3a draft C | | C o | 2:377a194b9b8a draft B2 | | B2 | x 1:830b6315076c draft B |/ B o 0:426bada5c675 draft A A $ cat c c $ cat b <<<<<<< destination: 52da76e91abb - test: C b2 ======= d >>>>>>> evolving: 57e51f6a6d36 D - test: D $ echo d2 > b $ hg resolve -m (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue evolving 4:57e51f6a6d36 "D" move:[5] E atop:[7] D $ hg glog o 8:3c658574f8ed draft tip | E o 7:16e609b952e8 draft | D o 6:52da76e91abb draft | C | x 5:eae7899dd92b draft E | | E | x 4:57e51f6a6d36 draft D | | D | x 3:bc77848cde3a draft C | | C o | 2:377a194b9b8a draft B2 | | B2 | x 1:830b6315076c draft B |/ B o 0:426bada5c675 draft A A $ hg cat -r tip b c e d2 c e $ cd .. Test that in-memory merge is disabled if there's a precommit hook $ hg init precommit-hook $ cd precommit-hook $ hg debugdrawdag <<'EOS' > C # C/c = c\n > B2 | # B2/b = b2\n > | B # B/b = b\n > \ / # replace: B -> B2 > A > EOS 1 new orphan changesets $ cat >> .hg/hgrc <<EOF > [hooks] > precommit = echo "running precommit hook" > EOF The hook is not run with in-memory=force $ hg evolve --config experimental.evolution.in-memory=force move:[3] C atop:[2] B2 $ hg touch tip^ 1 new orphan changesets The hook is run with in-memory=yes $ hg evolve --config experimental.evolution.in-memory=yes move:[4] C atop:[5] B2 running precommit hook