Mercurial > hg
comparison tests/test-rebase-obsolete4.t @ 46829:13b200ffe8eb
tests: split up test-rebase-obsolete.t in four pieces
The test case took 42 seconds to run the test before this patch and 12
seconds after (wall time, of course).
Differential Revision: https://phab.mercurial-scm.org/D10255
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 23 Mar 2021 09:13:29 -0700 |
parents | tests/test-rebase-obsolete.t@32399d0813e0 |
children | 6b42343f3cb6 |
comparison
equal
deleted
inserted
replaced
46828:395cf404e76a | 46829:13b200ffe8eb |
---|---|
1 ========================== | |
2 Test rebase with obsolete | |
3 ========================== | |
4 | |
5 Enable obsolete | |
6 | |
7 $ cat >> $HGRCPATH << EOF | |
8 > [command-templates] | |
9 > log= {rev}:{node|short} {desc|firstline}{if(obsolete,' ({obsfate})')} | |
10 > [experimental] | |
11 > evolution.createmarkers=True | |
12 > evolution.allowunstable=True | |
13 > [phases] | |
14 > publish=False | |
15 > [extensions] | |
16 > rebase= | |
17 > drawdag=$TESTDIR/drawdag.py | |
18 > strip= | |
19 > EOF | |
20 | |
21 Test that bookmark is moved and working dir is updated when all changesets have | |
22 equivalents in destination | |
23 $ hg init rbsrepo && cd rbsrepo | |
24 $ echo "[experimental]" > .hg/hgrc | |
25 $ echo "evolution=true" >> .hg/hgrc | |
26 $ echo "rebaseskipobsolete=on" >> .hg/hgrc | |
27 $ echo root > root && hg ci -Am root | |
28 adding root | |
29 $ echo a > a && hg ci -Am a | |
30 adding a | |
31 $ hg up 0 | |
32 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
33 $ echo b > b && hg ci -Am b | |
34 adding b | |
35 created new head | |
36 $ hg rebase -r 2 -d 1 | |
37 rebasing 2:1e9a3c00cbe9 tip "b" | |
38 $ hg log -r . # working dir is at rev 3 (successor of 2) | |
39 3:be1832deae9a b (no-eol) | |
40 $ hg book -r 2 mybook --hidden # rev 2 has a bookmark on it now | |
41 bookmarking hidden changeset 1e9a3c00cbe9 | |
42 (hidden revision '1e9a3c00cbe9' was rewritten as: be1832deae9a) | |
43 $ hg up 2 && hg log -r . # working dir is at rev 2 again | |
44 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
45 2:1e9a3c00cbe9 b (rewritten using rebase as 3:be1832deae9a) (no-eol) | |
46 $ hg rebase -r 2 -d 3 --config experimental.evolution.track-operation=1 | |
47 note: not rebasing 2:1e9a3c00cbe9 mybook "b", already in destination as 3:be1832deae9a tip "b" | |
48 Check that working directory and bookmark was updated to rev 3 although rev 2 | |
49 was skipped | |
50 $ hg log -r . | |
51 3:be1832deae9a b (no-eol) | |
52 $ hg bookmarks | |
53 mybook 3:be1832deae9a | |
54 $ hg debugobsolete --rev tip | |
55 1e9a3c00cbe90d236ac05ef61efcc5e40b7412bc be1832deae9ac531caa7438b8dcf6055a122cd8e 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'rebase', 'user': 'test'} | |
56 | |
57 Obsoleted working parent and bookmark could be moved if an ancestor of working | |
58 parent gets moved: | |
59 | |
60 $ hg init $TESTTMP/ancestor-wd-move | |
61 $ cd $TESTTMP/ancestor-wd-move | |
62 $ hg debugdrawdag <<'EOS' | |
63 > E D1 # rebase: D1 -> D2 | |
64 > | | | |
65 > | C | |
66 > D2 | | |
67 > | B | |
68 > |/ | |
69 > A | |
70 > EOS | |
71 $ hg update D1 -q | |
72 $ hg bookmark book -i | |
73 $ hg rebase -r B+D1 -d E | |
74 rebasing 1:112478962961 B "B" | |
75 note: not rebasing 5:15ecf15e0114 book D1 tip "D1", already in destination as 2:0807738e0be9 D2 "D2" | |
76 1 new orphan changesets | |
77 $ hg log -G -T '{desc} {bookmarks}' | |
78 @ B book | |
79 | | |
80 | x D1 | |
81 | | | |
82 o | E | |
83 | | | |
84 | * C | |
85 | | | |
86 o | D2 | |
87 | | | |
88 | x B | |
89 |/ | |
90 o A | |
91 | |
92 Rebasing a merge with one of its parent having a hidden successor | |
93 | |
94 $ hg init $TESTTMP/merge-p1-hidden-successor | |
95 $ cd $TESTTMP/merge-p1-hidden-successor | |
96 | |
97 $ hg debugdrawdag <<'EOS' | |
98 > E | |
99 > | | |
100 > B3 B2 # amend: B1 -> B2 -> B3 | |
101 > |/ # B2 is hidden | |
102 > | D | |
103 > | |\ | |
104 > | B1 C | |
105 > |/ | |
106 > A | |
107 > EOS | |
108 1 new orphan changesets | |
109 | |
110 $ eval `hg tags -T '{tag}={node}\n'` | |
111 $ rm .hg/localtags | |
112 | |
113 $ hg rebase -r $D -d $E | |
114 rebasing 5:9e62094e4d94 "D" | |
115 | |
116 $ hg log -G | |
117 o 7:a699d059adcf D | |
118 |\ | |
119 | o 6:ecc93090a95c E | |
120 | | | |
121 | o 4:0dc878468a23 B3 | |
122 | | | |
123 o | 1:96cc3511f894 C | |
124 / | |
125 o 0:426bada5c675 A | |
126 | |
127 For some reasons (--hidden, rebaseskipobsolete=0, directaccess, etc.), | |
128 rebasestate may contain hidden hashes. "rebase --abort" should work regardless. | |
129 | |
130 $ hg init $TESTTMP/hidden-state1 | |
131 $ cd $TESTTMP/hidden-state1 | |
132 $ cat >> .hg/hgrc <<EOF | |
133 > [experimental] | |
134 > rebaseskipobsolete=0 | |
135 > EOF | |
136 | |
137 $ hg debugdrawdag <<'EOS' | |
138 > C | |
139 > | | |
140 > D B # prune: B, C | |
141 > |/ # B/D=B | |
142 > A | |
143 > EOS | |
144 | |
145 $ eval `hg tags -T '{tag}={node}\n'` | |
146 $ rm .hg/localtags | |
147 | |
148 $ hg update -q $C --hidden | |
149 updated to hidden changeset 7829726be4dc | |
150 (hidden revision '7829726be4dc' is pruned) | |
151 $ hg rebase -s $B -d $D | |
152 rebasing 1:2ec65233581b "B" | |
153 merging D | |
154 warning: conflicts while merging D! (edit, then use 'hg resolve --mark') | |
155 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
156 [240] | |
157 | |
158 $ cp -R . $TESTTMP/hidden-state2 | |
159 | |
160 $ hg log -G | |
161 @ 2:b18e25de2cf5 D | |
162 | | |
163 | % 1:2ec65233581b B (pruned using prune) | |
164 |/ | |
165 o 0:426bada5c675 A | |
166 | |
167 $ hg summary | |
168 parent: 2:b18e25de2cf5 tip | |
169 D | |
170 branch: default | |
171 commit: 1 modified, 1 added, 1 unknown, 1 unresolved | |
172 update: 1 new changesets, 2 branch heads (merge) | |
173 phases: 3 draft | |
174 rebase: 0 rebased, 2 remaining (rebase --continue) | |
175 | |
176 $ hg rebase --abort | |
177 rebase aborted | |
178 | |
179 Also test --continue for the above case | |
180 | |
181 $ cd $TESTTMP/hidden-state2 | |
182 $ hg resolve -m | |
183 (no more unresolved files) | |
184 continue: hg rebase --continue | |
185 $ hg rebase --continue | |
186 rebasing 1:2ec65233581b "B" | |
187 rebasing 3:7829726be4dc tip "C" | |
188 $ hg log -G | |
189 @ 5:1964d5d5b547 C | |
190 | | |
191 o 4:68deb90c12a2 B | |
192 | | |
193 o 2:b18e25de2cf5 D | |
194 | | |
195 o 0:426bada5c675 A | |
196 | |
197 ==================== | |
198 Test --stop option | | |
199 ==================== | |
200 $ cd .. | |
201 $ hg init rbstop | |
202 $ cd rbstop | |
203 $ echo a>a | |
204 $ hg ci -Aqma | |
205 $ echo b>b | |
206 $ hg ci -Aqmb | |
207 $ echo c>c | |
208 $ hg ci -Aqmc | |
209 $ echo d>d | |
210 $ hg ci -Aqmd | |
211 $ hg up 0 -q | |
212 $ echo f>f | |
213 $ hg ci -Aqmf | |
214 $ echo D>d | |
215 $ hg ci -Aqm "conflict with d" | |
216 $ hg up 3 -q | |
217 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
218 o 5:00bfc9898aeb test | |
219 | conflict with d | |
220 | | |
221 o 4:dafd40200f93 test | |
222 | f | |
223 | | |
224 | @ 3:055a42cdd887 test | |
225 | | d | |
226 | | | |
227 | o 2:177f92b77385 test | |
228 | | c | |
229 | | | |
230 | o 1:d2ae7f538514 test | |
231 |/ b | |
232 | | |
233 o 0:cb9a9f314b8b test | |
234 a | |
235 | |
236 $ hg rebase -s 1 -d 5 | |
237 rebasing 1:d2ae7f538514 "b" | |
238 rebasing 2:177f92b77385 "c" | |
239 rebasing 3:055a42cdd887 "d" | |
240 merging d | |
241 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
242 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
243 [240] | |
244 $ hg rebase --stop | |
245 1 new orphan changesets | |
246 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
247 o 7:7fffad344617 test | |
248 | c | |
249 | | |
250 o 6:b15528633407 test | |
251 | b | |
252 | | |
253 o 5:00bfc9898aeb test | |
254 | conflict with d | |
255 | | |
256 o 4:dafd40200f93 test | |
257 | f | |
258 | | |
259 | @ 3:055a42cdd887 test | |
260 | | d | |
261 | | | |
262 | x 2:177f92b77385 test | |
263 | | c | |
264 | | | |
265 | x 1:d2ae7f538514 test | |
266 |/ b | |
267 | | |
268 o 0:cb9a9f314b8b test | |
269 a | |
270 | |
271 Test it aborts if unstable csets is not allowed: | |
272 =============================================== | |
273 $ cat >> $HGRCPATH << EOF | |
274 > [experimental] | |
275 > evolution.allowunstable=False | |
276 > EOF | |
277 | |
278 $ hg strip 6 --no-backup -q | |
279 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
280 o 5:00bfc9898aeb test | |
281 | conflict with d | |
282 | | |
283 o 4:dafd40200f93 test | |
284 | f | |
285 | | |
286 | @ 3:055a42cdd887 test | |
287 | | d | |
288 | | | |
289 | o 2:177f92b77385 test | |
290 | | c | |
291 | | | |
292 | o 1:d2ae7f538514 test | |
293 |/ b | |
294 | | |
295 o 0:cb9a9f314b8b test | |
296 a | |
297 | |
298 $ hg rebase -s 1 -d 5 | |
299 rebasing 1:d2ae7f538514 "b" | |
300 rebasing 2:177f92b77385 "c" | |
301 rebasing 3:055a42cdd887 "d" | |
302 merging d | |
303 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
304 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
305 [240] | |
306 $ hg rebase --stop | |
307 abort: cannot remove original changesets with unrebased descendants | |
308 (either enable obsmarkers to allow unstable revisions or use --keep to keep original changesets) | |
309 [20] | |
310 $ hg rebase --abort | |
311 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg | |
312 rebase aborted | |
313 | |
314 Test --stop when --keep is passed: | |
315 ================================== | |
316 $ hg rebase -s 1 -d 5 --keep | |
317 rebasing 1:d2ae7f538514 "b" | |
318 rebasing 2:177f92b77385 "c" | |
319 rebasing 3:055a42cdd887 "d" | |
320 merging d | |
321 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
322 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
323 [240] | |
324 $ hg rebase --stop | |
325 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
326 o 7:7fffad344617 test | |
327 | c | |
328 | | |
329 o 6:b15528633407 test | |
330 | b | |
331 | | |
332 o 5:00bfc9898aeb test | |
333 | conflict with d | |
334 | | |
335 o 4:dafd40200f93 test | |
336 | f | |
337 | | |
338 | @ 3:055a42cdd887 test | |
339 | | d | |
340 | | | |
341 | o 2:177f92b77385 test | |
342 | | c | |
343 | | | |
344 | o 1:d2ae7f538514 test | |
345 |/ b | |
346 | | |
347 o 0:cb9a9f314b8b test | |
348 a | |
349 | |
350 Test --stop aborts when --collapse was passed: | |
351 ============================================= | |
352 $ cat >> $HGRCPATH << EOF | |
353 > [experimental] | |
354 > evolution.allowunstable=True | |
355 > EOF | |
356 | |
357 $ hg strip 6 | |
358 saved backup bundle to $TESTTMP/rbstop/.hg/strip-backup/b15528633407-6eb72b6f-backup.hg | |
359 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
360 o 5:00bfc9898aeb test | |
361 | conflict with d | |
362 | | |
363 o 4:dafd40200f93 test | |
364 | f | |
365 | | |
366 | @ 3:055a42cdd887 test | |
367 | | d | |
368 | | | |
369 | o 2:177f92b77385 test | |
370 | | c | |
371 | | | |
372 | o 1:d2ae7f538514 test | |
373 |/ b | |
374 | | |
375 o 0:cb9a9f314b8b test | |
376 a | |
377 | |
378 $ hg rebase -s 1 -d 5 --collapse -m "collapsed b c d" | |
379 rebasing 1:d2ae7f538514 "b" | |
380 rebasing 2:177f92b77385 "c" | |
381 rebasing 3:055a42cdd887 "d" | |
382 merging d | |
383 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
384 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
385 [240] | |
386 $ hg rebase --stop | |
387 abort: cannot stop in --collapse session | |
388 [20] | |
389 $ hg rebase --abort | |
390 rebase aborted | |
391 $ hg diff | |
392 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" | |
393 o 5:00bfc9898aeb test | |
394 | conflict with d | |
395 | | |
396 o 4:dafd40200f93 test | |
397 | f | |
398 | | |
399 | @ 3:055a42cdd887 test | |
400 | | d | |
401 | | | |
402 | o 2:177f92b77385 test | |
403 | | c | |
404 | | | |
405 | o 1:d2ae7f538514 test | |
406 |/ b | |
407 | | |
408 o 0:cb9a9f314b8b test | |
409 a | |
410 | |
411 Test --stop raise errors with conflicting options: | |
412 ================================================= | |
413 $ hg rebase -s 3 -d 5 | |
414 rebasing 3:055a42cdd887 "d" | |
415 merging d | |
416 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
417 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
418 [240] | |
419 $ hg rebase --stop --dry-run | |
420 abort: cannot specify both --stop and --dry-run | |
421 [10] | |
422 | |
423 $ hg rebase -s 3 -d 5 | |
424 abort: rebase in progress | |
425 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop') | |
426 [20] | |
427 $ hg rebase --stop --continue | |
428 abort: cannot specify both --stop and --continue | |
429 [10] | |
430 | |
431 Test --stop moves bookmarks of original revisions to new rebased nodes: | |
432 ====================================================================== | |
433 $ cd .. | |
434 $ hg init repo | |
435 $ cd repo | |
436 | |
437 $ echo a > a | |
438 $ hg ci -Am A | |
439 adding a | |
440 | |
441 $ echo b > b | |
442 $ hg ci -Am B | |
443 adding b | |
444 $ hg book X | |
445 $ hg book Y | |
446 | |
447 $ echo c > c | |
448 $ hg ci -Am C | |
449 adding c | |
450 $ hg book Z | |
451 | |
452 $ echo d > d | |
453 $ hg ci -Am D | |
454 adding d | |
455 | |
456 $ hg up 0 -q | |
457 $ echo e > e | |
458 $ hg ci -Am E | |
459 adding e | |
460 created new head | |
461 | |
462 $ echo doubt > d | |
463 $ hg ci -Am "conflict with d" | |
464 adding d | |
465 | |
466 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n" | |
467 @ 5: 39adf30bc1be 'conflict with d' bookmarks: | |
468 | | |
469 o 4: 9c1e55f411b6 'E' bookmarks: | |
470 | | |
471 | o 3: 67a385d4e6f2 'D' bookmarks: Z | |
472 | | | |
473 | o 2: 49cb3485fa0c 'C' bookmarks: Y | |
474 | | | |
475 | o 1: 6c81ed0049f8 'B' bookmarks: X | |
476 |/ | |
477 o 0: 1994f17a630e 'A' bookmarks: | |
478 | |
479 $ hg rebase -s 1 -d 5 | |
480 rebasing 1:6c81ed0049f8 X "B" | |
481 rebasing 2:49cb3485fa0c Y "C" | |
482 rebasing 3:67a385d4e6f2 Z "D" | |
483 merging d | |
484 warning: conflicts while merging d! (edit, then use 'hg resolve --mark') | |
485 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
486 [240] | |
487 $ hg rebase --stop | |
488 1 new orphan changesets | |
489 $ hg log -GT "{rev}: {node|short} '{desc}' bookmarks: {bookmarks}\n" | |
490 o 7: 9c86c650b686 'C' bookmarks: Y | |
491 | | |
492 o 6: 9b87b54e5fd8 'B' bookmarks: X | |
493 | | |
494 @ 5: 39adf30bc1be 'conflict with d' bookmarks: | |
495 | | |
496 o 4: 9c1e55f411b6 'E' bookmarks: | |
497 | | |
498 | * 3: 67a385d4e6f2 'D' bookmarks: Z | |
499 | | | |
500 | x 2: 49cb3485fa0c 'C' bookmarks: | |
501 | | | |
502 | x 1: 6c81ed0049f8 'B' bookmarks: | |
503 |/ | |
504 o 0: 1994f17a630e 'A' bookmarks: | |
505 |