comparison 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
comparison
equal deleted inserted replaced
5776:453ba695c3d4 5777:c5dfbbe4363d
6 > [extensions] 6 > [extensions]
7 > evolve = 7 > evolve =
8 > drawdag=$RUNTESTDIR/drawdag.py 8 > drawdag=$RUNTESTDIR/drawdag.py
9 > [alias] 9 > [alias]
10 > glog = log -G -T '{rev}:{node|short} {separate(" ", phase, tags)}\n{desc|firstline}' 10 > glog = log -G -T '{rev}:{node|short} {separate(" ", phase, tags)}\n{desc|firstline}'
11 > [experimental]
12 > evolution.in-memory = yes
11 > EOF 13 > EOF
12 14
13 Test evolving a single orphan 15 Test evolving a single orphan
14 16
15 $ hg init single-orphan 17 $ hg init single-orphan
61 $ hg evolve 63 $ hg evolve
62 move:[3] C 64 move:[3] C
63 atop:[2] B2 65 atop:[2] B2
64 move:[4] D 66 move:[4] D
65 merging b 67 merging b
68 hit merge conflicts; retrying merge in working copy
69 merging b
66 warning: conflicts while merging b! (edit, then use 'hg resolve --mark') 70 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
67 unresolved merge conflicts 71 unresolved merge conflicts
68 (see 'hg help evolve.interrupted') 72 (see 'hg help evolve.interrupted')
69 [240] 73 [240]
70 $ hg glog 74 $ hg glog
96 continue: hg evolve --continue 100 continue: hg evolve --continue
97 $ hg evolve --continue 101 $ hg evolve --continue
98 evolving 4:57e51f6a6d36 "D" 102 evolving 4:57e51f6a6d36 "D"
99 move:[5] E 103 move:[5] E
100 atop:[7] D 104 atop:[7] D
101 working directory is now at 000000000000
102 $ hg glog 105 $ hg glog
103 o 8:3c658574f8ed draft tip 106 o 8:3c658574f8ed draft tip
104 | E 107 | E
105 o 7:16e609b952e8 draft 108 o 7:16e609b952e8 draft
106 | D 109 | D
121 $ hg cat -r tip b c e 124 $ hg cat -r tip b c e
122 d2 125 d2
123 c 126 c
124 e 127 e
125 $ cd .. 128 $ cd ..
129
130 Test that in-memory merge is disabled if there's a precommit hook
131
132 $ hg init precommit-hook
133 $ cd precommit-hook
134 $ hg debugdrawdag <<'EOS'
135 > C # C/c = c\n
136 > B2 | # B2/b = b2\n
137 > | B # B/b = b\n
138 > \ / # replace: B -> B2
139 > A
140 > EOS
141 1 new orphan changesets
142 $ cat >> .hg/hgrc <<EOF
143 > [hooks]
144 > precommit = echo "running precommit hook"
145 > EOF
146 The hook is not run with in-memory=force
147 $ hg evolve --config experimental.evolution.in-memory=force
148 move:[3] C
149 atop:[2] B2
150 $ hg touch tip^
151 1 new orphan changesets
152 The hook is run with in-memory=yes
153 $ hg evolve --config experimental.evolution.in-memory=yes
154 move:[4] C
155 atop:[5] B2
156 running precommit hook