Mercurial > hg
comparison tests/test-rebase-base-flag.t @ 34504:8cef8f7d51d0
test-rebase-base: clarify it is about the "--base" flag
It happened several times that people use `test-rebase-base.t` as a general
purposed test file for rebase. But it is intended to be only related to the
`--base` flag. This patch split, renamed the test, and added a note to
clarify.
Differential Revision: https://phab.mercurial-scm.org/D975
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 05 Oct 2017 20:41:50 -0700 |
parents | tests/test-rebase-base.t@609606d21765 |
children | 469b06b4c3ca |
comparison
equal
deleted
inserted
replaced
34503:0d5a1175d0f9 | 34504:8cef8f7d51d0 |
---|---|
1 Test the "--base" flag of the rebase command. (Tests unrelated to the "--base" | |
2 flag should probably live in somewhere else) | |
3 | |
4 $ cat >> $HGRCPATH <<EOF | |
5 > [extensions] | |
6 > rebase= | |
7 > drawdag=$TESTDIR/drawdag.py | |
8 > | |
9 > [phases] | |
10 > publish=False | |
11 > | |
12 > [alias] | |
13 > tglog = log -G --template "{rev}: {desc}" | |
14 > EOF | |
15 | |
16 $ rebasewithdag() { | |
17 > N=`$PYTHON -c "print($N+1)"` | |
18 > hg init repo$N && cd repo$N | |
19 > hg debugdrawdag | |
20 > hg rebase "$@" > _rebasetmp | |
21 > r=$? | |
22 > grep -v 'saved backup bundle' _rebasetmp | |
23 > [ $r -eq 0 ] && hg tglog | |
24 > cd .. | |
25 > return $r | |
26 > } | |
27 | |
28 Single branching point, without merge: | |
29 | |
30 $ rebasewithdag -b D -d Z <<'EOS' | |
31 > D E | |
32 > |/ | |
33 > Z B C # C: branching point, E should be picked | |
34 > \|/ # B should not be picked | |
35 > A | |
36 > | | |
37 > R | |
38 > EOS | |
39 rebasing 3:d6003a550c2c "C" (C) | |
40 rebasing 5:4526cf523425 "D" (D) | |
41 rebasing 6:b296604d9846 "E" (E tip) | |
42 o 6: E | |
43 | | |
44 | o 5: D | |
45 |/ | |
46 o 4: C | |
47 | | |
48 o 3: Z | |
49 | | |
50 | o 2: B | |
51 |/ | |
52 o 1: A | |
53 | | |
54 o 0: R | |
55 | |
56 Multiple branching points caused by selecting a single merge changeset: | |
57 | |
58 $ rebasewithdag -b E -d Z <<'EOS' | |
59 > E | |
60 > /| | |
61 > B C D # B, C: multiple branching points | |
62 > | |/ # D should not be picked | |
63 > Z | / | |
64 > \|/ | |
65 > A | |
66 > | | |
67 > R | |
68 > EOS | |
69 rebasing 2:c1e6b162678d "B" (B) | |
70 rebasing 3:d6003a550c2c "C" (C) | |
71 rebasing 6:54c8f00cb91c "E" (E tip) | |
72 o 6: E | |
73 |\ | |
74 | o 5: C | |
75 | | | |
76 o | 4: B | |
77 |/ | |
78 o 3: Z | |
79 | | |
80 | o 2: D | |
81 |/ | |
82 o 1: A | |
83 | | |
84 o 0: R | |
85 | |
86 Rebase should not extend the "--base" revset using "descendants": | |
87 | |
88 $ rebasewithdag -b B -d Z <<'EOS' | |
89 > E | |
90 > /| | |
91 > Z B C # descendants(B) = B+E. With E, C will be included incorrectly | |
92 > \|/ | |
93 > A | |
94 > | | |
95 > R | |
96 > EOS | |
97 rebasing 2:c1e6b162678d "B" (B) | |
98 rebasing 5:54c8f00cb91c "E" (E tip) | |
99 o 5: E | |
100 |\ | |
101 | o 4: B | |
102 | | | |
103 | o 3: Z | |
104 | | | |
105 o | 2: C | |
106 |/ | |
107 o 1: A | |
108 | | |
109 o 0: R | |
110 | |
111 Rebase should not simplify the "--base" revset using "roots": | |
112 | |
113 $ rebasewithdag -b B+E -d Z <<'EOS' | |
114 > E | |
115 > /| | |
116 > Z B C # roots(B+E) = B. Without E, C will be missed incorrectly | |
117 > \|/ | |
118 > A | |
119 > | | |
120 > R | |
121 > EOS | |
122 rebasing 2:c1e6b162678d "B" (B) | |
123 rebasing 3:d6003a550c2c "C" (C) | |
124 rebasing 5:54c8f00cb91c "E" (E tip) | |
125 o 5: E | |
126 |\ | |
127 | o 4: C | |
128 | | | |
129 o | 3: B | |
130 |/ | |
131 o 2: Z | |
132 | | |
133 o 1: A | |
134 | | |
135 o 0: R | |
136 | |
137 The destination is one of the two branching points of a merge: | |
138 | |
139 $ rebasewithdag -b F -d Z <<'EOS' | |
140 > F | |
141 > / \ | |
142 > E D | |
143 > / / | |
144 > Z C | |
145 > \ / | |
146 > B | |
147 > | | |
148 > A | |
149 > EOS | |
150 nothing to rebase | |
151 [1] | |
152 | |
153 Multiple branching points caused by multiple bases (issue5420): | |
154 | |
155 $ rebasewithdag -b E1+E2+C2+B1 -d Z <<'EOS' | |
156 > Z E2 | |
157 > | / | |
158 > F E1 C2 | |
159 > |/ / | |
160 > E C1 B2 | |
161 > |/ / | |
162 > C B1 | |
163 > |/ | |
164 > B | |
165 > | | |
166 > A | |
167 > | | |
168 > R | |
169 > EOS | |
170 rebasing 3:a113dbaa660a "B1" (B1) | |
171 rebasing 5:06ce7b1cc8c2 "B2" (B2) | |
172 rebasing 6:0ac98cce32d3 "C1" (C1) | |
173 rebasing 8:781512f5e33d "C2" (C2) | |
174 rebasing 9:428d8c18f641 "E1" (E1) | |
175 rebasing 11:e1bf82f6b6df "E2" (E2) | |
176 o 12: E2 | |
177 | | |
178 o 11: E1 | |
179 | | |
180 | o 10: C2 | |
181 | | | |
182 | o 9: C1 | |
183 |/ | |
184 | o 8: B2 | |
185 | | | |
186 | o 7: B1 | |
187 |/ | |
188 o 6: Z | |
189 | | |
190 o 5: F | |
191 | | |
192 o 4: E | |
193 | | |
194 o 3: C | |
195 | | |
196 o 2: B | |
197 | | |
198 o 1: A | |
199 | | |
200 o 0: R | |
201 | |
202 Multiple branching points with multiple merges: | |
203 | |
204 $ rebasewithdag -b G+P -d Z <<'EOS' | |
205 > G H P | |
206 > |\ /| |\ | |
207 > F E D M N | |
208 > \|/| /| |\ | |
209 > Z C B I J K L | |
210 > \|/ |/ |/ | |
211 > A A A | |
212 > EOS | |
213 rebasing 2:dc0947a82db8 "C" (C) | |
214 rebasing 8:4e4f9194f9f1 "D" (D) | |
215 rebasing 9:03ca77807e91 "E" (E) | |
216 rebasing 10:afc707c82df0 "F" (F) | |
217 rebasing 13:690dfff91e9e "G" (G) | |
218 rebasing 14:2893b886bb10 "H" (H) | |
219 rebasing 3:08ebfeb61bac "I" (I) | |
220 rebasing 4:a0a5005cec67 "J" (J) | |
221 rebasing 5:83780307a7e8 "K" (K) | |
222 rebasing 6:e131637a1cb6 "L" (L) | |
223 rebasing 11:d1f6d0c3c7e4 "M" (M) | |
224 rebasing 12:7aaec6f81888 "N" (N) | |
225 rebasing 15:325bc8f1760d "P" (P tip) | |
226 o 15: P | |
227 |\ | |
228 | o 14: N | |
229 | |\ | |
230 o \ \ 13: M | |
231 |\ \ \ | |
232 | | | o 12: L | |
233 | | | | | |
234 | | o | 11: K | |
235 | | |/ | |
236 | o / 10: J | |
237 | |/ | |
238 o / 9: I | |
239 |/ | |
240 | o 8: H | |
241 | |\ | |
242 | | | o 7: G | |
243 | | |/| | |
244 | | | o 6: F | |
245 | | | | | |
246 | | o | 5: E | |
247 | | |/ | |
248 | o | 4: D | |
249 | |\| | |
250 +---o 3: C | |
251 | | | |
252 o | 2: Z | |
253 | | | |
254 | o 1: B | |
255 |/ | |
256 o 0: A | |
257 | |
258 Slightly more complex merge case (mentioned in https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-November/091074.html): | |
259 | |
260 $ rebasewithdag -b A3+B3 -d Z <<'EOF' | |
261 > Z C1 A3 B3 | |
262 > | / / \ / \ | |
263 > M3 C0 A1 A2 B1 B2 | |
264 > | / | | | | | |
265 > M2 M1 C1 C1 M3 | |
266 > | | |
267 > M1 | |
268 > | | |
269 > M0 | |
270 > EOF | |
271 rebasing 4:8817fae53c94 "C0" (C0) | |
272 rebasing 6:06ca5dfe3b5b "B2" (B2) | |
273 rebasing 7:73508237b032 "C1" (C1) | |
274 rebasing 9:fdb955e2faed "A2" (A2) | |
275 rebasing 11:4e449bd1a643 "A3" (A3) | |
276 rebasing 10:0a33b0519128 "B1" (B1) | |
277 rebasing 12:209327807c3a "B3" (B3 tip) | |
278 o 12: B3 | |
279 |\ | |
280 | o 11: B1 | |
281 | | | |
282 | | o 10: A3 | |
283 | | |\ | |
284 | +---o 9: A2 | |
285 | | | | |
286 | o | 8: C1 | |
287 | | | | |
288 o | | 7: B2 | |
289 | | | | |
290 | o | 6: C0 | |
291 |/ / | |
292 o | 5: Z | |
293 | | | |
294 o | 4: M3 | |
295 | | | |
296 o | 3: M2 | |
297 | | | |
298 | o 2: A1 | |
299 |/ | |
300 o 1: M1 | |
301 | | |
302 o 0: M0 | |
303 | |
304 Disconnected graph: | |
305 | |
306 $ rebasewithdag -b B -d Z <<'EOS' | |
307 > B | |
308 > | | |
309 > Z A | |
310 > EOS | |
311 nothing to rebase from 112478962961 to 48b9aae0607f | |
312 [1] | |
313 | |
314 Multiple roots. Roots are ancestors of dest: | |
315 | |
316 $ rebasewithdag -b B+D -d Z <<'EOF' | |
317 > D Z B | |
318 > \|\| | |
319 > C A | |
320 > EOF | |
321 rebasing 2:112478962961 "B" (B) | |
322 rebasing 3:b70f76719894 "D" (D) | |
323 o 4: D | |
324 | | |
325 | o 3: B | |
326 |/ | |
327 o 2: Z | |
328 |\ | |
329 | o 1: C | |
330 | | |
331 o 0: A | |
332 | |
333 Multiple roots. One root is not an ancestor of dest: | |
334 | |
335 $ rebasewithdag -b B+D -d Z <<'EOF' | |
336 > Z B D | |
337 > \|\| | |
338 > A C | |
339 > EOF | |
340 nothing to rebase from f675d5a1c6a4+b70f76719894 to 262e37e34f63 | |
341 [1] | |
342 | |
343 Multiple roots. One root is not an ancestor of dest. Select using a merge: | |
344 | |
345 $ rebasewithdag -b E -d Z <<'EOF' | |
346 > E | |
347 > |\ | |
348 > Z B D | |
349 > \|\| | |
350 > A C | |
351 > EOF | |
352 rebasing 2:f675d5a1c6a4 "B" (B) | |
353 rebasing 5:f68696fe6af8 "E" (E tip) | |
354 o 5: E | |
355 |\ | |
356 | o 4: B | |
357 | |\ | |
358 | | o 3: Z | |
359 | | | | |
360 o | | 2: D | |
361 |/ / | |
362 o / 1: C | |
363 / | |
364 o 0: A | |
365 | |
366 Multiple roots. Two children share two parents while dest has only one parent: | |
367 | |
368 $ rebasewithdag -b B+D -d Z <<'EOF' | |
369 > Z B D | |
370 > \|\|\ | |
371 > A C A | |
372 > EOF | |
373 rebasing 2:f675d5a1c6a4 "B" (B) | |
374 rebasing 3:c2a779e13b56 "D" (D) | |
375 o 4: D | |
376 |\ | |
377 +---o 3: B | |
378 | |/ | |
379 | o 2: Z | |
380 | | | |
381 o | 1: C | |
382 / | |
383 o 0: A | |
384 |