Debian Codegraph @

tests/test-rebase-obsolete4.t

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