Debian Codegraph @

tests/test-rebase-conflicts.t

raw
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > rebase=
4 > drawdag=$TESTDIR/drawdag.py
5 >
6 > [phases]
7 > publish=False
8 >
9 > [alias]
10 > tglog = log -G --template "{rev}:{phase} '{desc}' {branches} {bookmarks}\n"
11 > EOF
12
13 $ hg init a
14 $ cd a
15 $ echo c1 >common
16 $ hg add common
17 $ hg ci -m C1
18
19 $ echo c2 >>common
20 $ hg ci -m C2
21
22 $ echo c3 >>common
23 $ hg ci -m C3
24
25 $ hg up -q -C 1
26
27 $ echo l1 >>extra
28 $ hg add extra
29 $ hg ci -m L1
30 created new head
31
32 $ sed -e 's/c2/l2/' common > common.new
33 $ mv common.new common
34 $ hg ci -m L2
35
36 $ echo l3 >> extra2
37 $ hg add extra2
38 $ hg ci -m L3
39 $ hg bookmark mybook
40
41 $ hg phase --force --secret 4
42
43 $ hg tglog
44 @ 5:secret 'L3' mybook
45 |
46 o 4:secret 'L2'
47 |
48 o 3:draft 'L1'
49 |
50 | o 2:draft 'C3'
51 |/
52 o 1:draft 'C2'
53 |
54 o 0:draft 'C1'
55
56 Try to call --continue:
57
58 $ hg rebase --continue
59 abort: no rebase in progress
60 [20]
61
62 Conflicting rebase:
63
64 $ hg rebase -s 3 -d 2
65 rebasing 3:3163e20567cc "L1"
66 rebasing 4:46f0b057b5c0 "L2"
67 merging common
68 warning: conflicts while merging common! (edit, then use 'hg resolve --mark')
69 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
70 [240]
71
72 $ hg status --config commands.status.verbose=1
73 M common
74 ? common.orig
75 # The repository is in an unfinished *rebase* state.
76
77 # Unresolved merge conflicts:
78 #
79 # common
80 #
81 # To mark files as resolved: hg resolve --mark FILE
82
83 # To continue: hg rebase --continue
84 # To abort: hg rebase --abort
85 # To stop: hg rebase --stop
86
87
88 Try to continue without solving the conflict:
89
90 $ hg rebase --continue
91 abort: unresolved merge conflicts (see 'hg help resolve')
92 [20]
93
94 Conclude rebase:
95
96 $ echo 'resolved merge' >common
97 $ hg resolve -m common
98 (no more unresolved files)
99 continue: hg rebase --continue
100 $ hg rebase --continue
101 already rebased 3:3163e20567cc "L1" as 3e046f2ecedb
102 rebasing 4:46f0b057b5c0 "L2"
103 rebasing 5:8029388f38dc mybook "L3"
104 saved backup bundle to $TESTTMP/a/.hg/strip-backup/3163e20567cc-5ca4656e-rebase.hg
105
106 $ hg tglog
107 @ 5:secret 'L3' mybook
108 |
109 o 4:secret 'L2'
110 |
111 o 3:draft 'L1'
112 |
113 o 2:draft 'C3'
114 |
115 o 1:draft 'C2'
116 |
117 o 0:draft 'C1'
118
119 Check correctness:
120
121 $ hg cat -r 0 common
122 c1
123
124 $ hg cat -r 1 common
125 c1
126 c2
127
128 $ hg cat -r 2 common
129 c1
130 c2
131 c3
132
133 $ hg cat -r 3 common
134 c1
135 c2
136 c3
137
138 $ hg cat -r 4 common
139 resolved merge
140
141 $ hg cat -r 5 common
142 resolved merge
143
144 Bookmark stays active after --continue
145 $ hg bookmarks
146 * mybook 5:d67b21408fc0
147
148 $ cd ..
149
150 Check that the right ancestors is used while rebasing a merge (issue4041)
151
152 $ hg init issue4041
153 $ cd issue4041
154 $ hg unbundle "$TESTDIR/bundles/issue4041.hg"
155 adding changesets
156 adding manifests
157 adding file changes
158 added 11 changesets with 8 changes to 3 files (+1 heads)
159 new changesets 24797d4f68de:2f2496ddf49d (11 drafts)
160 (run 'hg heads' to see heads)
161 $ hg up default
162 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
163 $ hg log -G
164 o changeset: 10:2f2496ddf49d
165 |\ branch: f1
166 | | tag: tip
167 | | parent: 7:4c9fbe56a16f
168 | | parent: 9:e31216eec445
169 | | user: szhang
170 | | date: Thu Sep 05 12:59:39 2013 -0400
171 | | summary: merge
172 | |
173 | o changeset: 9:e31216eec445
174 | | branch: f1
175 | | user: szhang
176 | | date: Thu Sep 05 12:59:10 2013 -0400
177 | | summary: more changes to f1
178 | |
179 | o changeset: 8:8e4e2c1a07ae
180 | |\ branch: f1
181 | | | parent: 2:4bc80088dc6b
182 | | | parent: 6:400110238667
183 | | | user: szhang
184 | | | date: Thu Sep 05 12:57:59 2013 -0400
185 | | | summary: bad merge
186 | | |
187 o | | changeset: 7:4c9fbe56a16f
188 |/ / branch: f1
189 | | parent: 2:4bc80088dc6b
190 | | user: szhang
191 | | date: Thu Sep 05 12:54:00 2013 -0400
192 | | summary: changed f1
193 | |
194 | o changeset: 6:400110238667
195 | | branch: f2
196 | | parent: 4:12e8ec6bb010
197 | | user: szhang
198 | | date: Tue Sep 03 13:58:02 2013 -0400
199 | | summary: changed f2 on f2
200 | |
201 | | @ changeset: 5:d79e2059b5c0
202 | | | parent: 3:8a951942e016
203 | | | user: szhang
204 | | | date: Tue Sep 03 13:57:39 2013 -0400
205 | | | summary: changed f2 on default
206 | | |
207 | o | changeset: 4:12e8ec6bb010
208 | |/ branch: f2
209 | | user: szhang
210 | | date: Tue Sep 03 13:57:18 2013 -0400
211 | | summary: created f2 branch
212 | |
213 | o changeset: 3:8a951942e016
214 | | parent: 0:24797d4f68de
215 | | user: szhang
216 | | date: Tue Sep 03 13:57:11 2013 -0400
217 | | summary: added f2.txt
218 | |
219 o | changeset: 2:4bc80088dc6b
220 | | branch: f1
221 | | user: szhang
222 | | date: Tue Sep 03 13:56:20 2013 -0400
223 | | summary: added f1.txt
224 | |
225 o | changeset: 1:ef53c9e6b608
226 |/ branch: f1
227 | user: szhang
228 | date: Tue Sep 03 13:55:26 2013 -0400
229 | summary: created f1 branch
230 |
231 o changeset: 0:24797d4f68de
232 user: szhang
233 date: Tue Sep 03 13:55:08 2013 -0400
234 summary: added default.txt
235
236 $ hg rebase -s9 -d2 --debug # use debug to really check merge base used
237 rebase onto 4bc80088dc6b starting from e31216eec445
238 rebasing on disk
239 rebase status stored
240 rebasing 9:e31216eec445 "more changes to f1"
241 future parents are 2 and -1
242 update to 2:4bc80088dc6b
243 resolving manifests
244 branchmerge: False, force: True, partial: False
245 ancestor: d79e2059b5c0+, local: d79e2059b5c0+, remote: 4bc80088dc6b
246 f2.txt: other deleted -> r
247 removing f2.txt
248 f1.txt: remote created -> g
249 getting f1.txt
250 merge against 9:e31216eec445
251 detach base 8:8e4e2c1a07ae
252 resolving manifests
253 branchmerge: True, force: True, partial: False
254 ancestor: 8e4e2c1a07ae, local: 4bc80088dc6b+, remote: e31216eec445
255 f1.txt: remote is newer -> g
256 getting f1.txt
257 committing files:
258 f1.txt
259 committing manifest
260 committing changelog
261 updating the branch cache
262 rebased as 19c888675e13
263 rebase status stored
264 rebasing 10:2f2496ddf49d tip "merge"
265 future parents are 11 and 7
266 already in destination
267 merge against 10:2f2496ddf49d
268 detach base 9:e31216eec445
269 resolving manifests
270 branchmerge: True, force: True, partial: False
271 ancestor: e31216eec445, local: 19c888675e13+, remote: 2f2496ddf49d
272 f1.txt: remote is newer -> g
273 getting f1.txt
274 committing files:
275 f1.txt
276 committing manifest
277 committing changelog
278 updating the branch cache
279 rebased as c1ffa3b5274e
280 rebase status stored
281 rebase merging completed
282 update back to initial working directory parent
283 resolving manifests (no-rust !)
284 branchmerge: False, force: False, partial: False (no-rust !)
285 ancestor: c1ffa3b5274e, local: c1ffa3b5274e+, remote: d79e2059b5c0 (no-rust !)
286 f1.txt: other deleted -> r (no-rust !)
287 removing f1.txt (no-rust !)
288 f2.txt: remote created -> g (no-rust !)
289 getting f2.txt (no-rust !)
290 2 changesets found
291 list of changesets:
292 e31216eec445e44352c5f01588856059466a24c9
293 2f2496ddf49d69b5ef23ad8cf9fb2e0e4faf0ac2
294 bundle2-output-bundle: "HG20", (1 params) 3 parts total
295 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
296 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
297 bundle2-output-part: "phase-heads" 24 bytes payload
298 saved backup bundle to $TESTTMP/issue4041/.hg/strip-backup/e31216eec445-15f7a814-rebase.hg
299 2 changesets found
300 list of changesets:
301 19c888675e133ab5dff84516926a65672eaf04d9
302 c1ffa3b5274e92a9388fe782854e295d2e8d0443
303 bundle2-output-bundle: "HG20", 3 parts total
304 bundle2-output-part: "changegroup" (params: 1 mandatory 1 advisory) streamed payload
305 bundle2-output-part: "cache:rev-branch-cache" (advisory) streamed payload
306 bundle2-output-part: "phase-heads" 24 bytes payload
307 adding branch
308 bundle2-input-bundle: with-transaction
309 bundle2-input-part: "changegroup" (params: 1 mandatory 1 advisory) supported
310 adding changesets
311 add changeset 19c888675e13
312 add changeset c1ffa3b5274e
313 adding manifests
314 adding file changes
315 adding f1.txt revisions
316 bundle2-input-part: total payload size 1255
317 bundle2-input-part: "cache:rev-branch-cache" (advisory) supported
318 bundle2-input-part: total payload size 54
319 bundle2-input-part: "phase-heads" supported
320 bundle2-input-part: total payload size 24
321 bundle2-input-bundle: 3 parts total
322 resetting content of rbc-names-v2
323 added 2 changesets with 2 changes to 1 files
324 updating the branch cache
325 invalid branch cache (served): tip differs
326 history modification detected - truncating revision branch cache to revision 1
327 invalid branch cache (served.hidden): tip differs
328 rebase completed
329 resetting content of cache/rbc-revs-v2
330
331 Test minimization of merge conflicts
332 $ hg up -q null
333 $ echo a > a
334 $ hg add a
335 $ hg commit -q -m 'a'
336 $ echo b >> a
337 $ hg commit -q -m 'ab'
338 $ hg bookmark ab
339 $ hg up -q '.^'
340 $ echo b >> a
341 $ echo c >> a
342 $ hg commit -q -m 'abc'
343 $ hg rebase -s 7bc217434fc1 -d ab --keep
344 rebasing 13:7bc217434fc1 tip "abc"
345 merging a
346 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
347 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
348 [240]
349 $ hg diff
350 diff -r 328e4ab1f7cc a
351 --- a/a Thu Jan 01 00:00:00 1970 +0000
352 +++ b/a * (glob)
353 @@ -1,2 +1,6 @@
354 a
355 b
356 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
357 +=======
358 +c
359 +>>>>>>> source: 7bc217434fc1 - test: abc
360 $ hg rebase --abort
361 rebase aborted
362 $ hg up -q -C 7bc217434fc1
363 $ hg rebase -s . -d ab --keep -t internal:merge3
364 rebasing 13:7bc217434fc1 tip "abc"
365 merging a
366 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
367 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
368 [240]
369 $ hg diff
370 diff -r 328e4ab1f7cc a
371 --- a/a Thu Jan 01 00:00:00 1970 +0000
372 +++ b/a * (glob)
373 @@ -1,2 +1,8 @@
374 a
375 +<<<<<<< dest: 328e4ab1f7cc ab - test: ab
376 b
377 +||||||| parent of source: cb9a9f314b8b - test: a
378 +=======
379 +b
380 +c
381 +>>>>>>> source: 7bc217434fc1 - test: abc
382
383 Test rebase with obsstore turned on and off (issue5606)
384
385 $ cd $TESTTMP
386 $ hg init b
387 $ cd b
388 $ hg debugdrawdag <<'EOS'
389 > D
390 > |
391 > C
392 > |
393 > B E
394 > |/
395 > A
396 > EOS
397
398 $ hg update E -q
399 $ echo 3 > B
400 $ hg commit --amend -m E -A B -q
401 $ hg rebase -r B+D -d . --config experimental.evolution=true
402 rebasing 1:112478962961 B "B"
403 merging B
404 warning: conflicts while merging B! (edit, then use 'hg resolve --mark')
405 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
406 [240]
407
408 $ echo 4 > B
409 $ hg resolve -m
410 (no more unresolved files)
411 continue: hg rebase --continue
412 $ hg rebase --continue --config experimental.evolution=none
413 rebasing 1:112478962961 B "B"
414 rebasing 3:f585351a92f8 D "D"
415 warning: orphaned descendants detected, not stripping 112478962961
416 saved backup bundle to $TESTTMP/b/.hg/strip-backup/f585351a92f8-e536a9e4-rebase.hg
417
418 $ rm .hg/localtags
419 $ hg tglog
420 o 5:draft 'D'
421 |
422 o 4:draft 'B'
423 |
424 @ 3:draft 'E'
425 |
426 | o 2:draft 'C'
427 | |
428 | o 1:draft 'B'
429 |/
430 o 0:draft 'A'
431
432
433 Test where the conflict happens when rebasing a merge commit
434
435 $ cd $TESTTMP
436 $ hg init conflict-in-merge
437 $ cd conflict-in-merge
438 $ hg debugdrawdag <<'EOS'
439 > F # F/conflict = foo\n
440 > |\
441 > D E
442 > |/
443 > C B # B/conflict = bar\n
444 > |/
445 > A
446 > EOS
447
448 $ hg co F
449 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 $ hg rebase -d B
451 rebasing 2:dc0947a82db8 C "C"
452 rebasing 3:e7b3f00ed42e D "D"
453 rebasing 4:03ca77807e91 E "E"
454 rebasing 5:9a6b91dc2044 F tip "F"
455 merging conflict
456 warning: conflicts while merging conflict! (edit, then use 'hg resolve --mark')
457 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
458 [240]
459 $ hg tglog
460 @ 8:draft 'E'
461 |
462 | @ 7:draft 'D'
463 |/
464 o 6:draft 'C'
465 |
466 | % 5:draft 'F'
467 | |\
468 | | o 4:draft 'E'
469 | | |
470 | o | 3:draft 'D'
471 | |/
472 | o 2:draft 'C'
473 | |
474 o | 1:draft 'B'
475 |/
476 o 0:draft 'A'
477
478 $ echo baz > conflict
479 $ hg resolve -m
480 (no more unresolved files)
481 continue: hg rebase --continue
482 $ hg rebase -c
483 already rebased 2:dc0947a82db8 C "C" as 0199610c343e
484 already rebased 3:e7b3f00ed42e D "D" as f0dd538aaa63
485 already rebased 4:03ca77807e91 E "E" as cbf25af8347d
486 rebasing 5:9a6b91dc2044 F "F"
487 saved backup bundle to $TESTTMP/conflict-in-merge/.hg/strip-backup/dc0947a82db8-ca7e7d5b-rebase.hg
488 $ hg tglog
489 @ 5:draft 'F'
490 |\
491 | o 4:draft 'E'
492 | |
493 o | 3:draft 'D'
494 |/
495 o 2:draft 'C'
496 |
497 o 1:draft 'B'
498 |
499 o 0:draft 'A'
500