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