##// END OF EJS Templates
rebase: add test case that shows that inmemory rebase does not preserve merges...
Manuel Jacob -
r45646:ab33782d default
parent child Browse files
Show More
@@ -1,922 +1,969
1 1 #require symlink execbit
2 2 $ cat << EOF >> $HGRCPATH
3 3 > [phases]
4 4 > publish=False
5 5 > [extensions]
6 6 > amend=
7 7 > rebase=
8 8 > debugdrawdag=$TESTDIR/drawdag.py
9 9 > strip=
10 10 > [rebase]
11 11 > experimental.inmemory=1
12 12 > [diff]
13 13 > git=1
14 14 > [alias]
15 15 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
16 16 > EOF
17 17
18 18 Rebase a simple DAG:
19 19 $ hg init repo1
20 20 $ cd repo1
21 21 $ hg debugdrawdag <<'EOS'
22 22 > c b
23 23 > |/
24 24 > d
25 25 > |
26 26 > a
27 27 > EOS
28 28 $ hg up -C a
29 29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30 $ hg tglog
31 31 o 3: 814f6bd05178 'c'
32 32 |
33 33 | o 2: db0e82a16a62 'b'
34 34 |/
35 35 o 1: 02952614a83d 'd'
36 36 |
37 37 @ 0: b173517d0057 'a'
38 38
39 39 $ hg cat -r 3 c
40 40 c (no-eol)
41 41 $ hg cat -r 2 b
42 42 b (no-eol)
43 43 $ hg rebase --debug -r b -d c | grep rebasing
44 44 rebasing in-memory
45 45 rebasing 2:db0e82a16a62 "b" (b)
46 46 $ hg tglog
47 47 o 3: ca58782ad1e4 'b'
48 48 |
49 49 o 2: 814f6bd05178 'c'
50 50 |
51 51 o 1: 02952614a83d 'd'
52 52 |
53 53 @ 0: b173517d0057 'a'
54 54
55 55 $ hg cat -r 3 b
56 56 b (no-eol)
57 57 $ hg cat -r 2 c
58 58 c (no-eol)
59 59 $ cd ..
60 60
61 61 Case 2:
62 62 $ hg init repo2
63 63 $ cd repo2
64 64 $ hg debugdrawdag <<'EOS'
65 65 > c b
66 66 > |/
67 67 > d
68 68 > |
69 69 > a
70 70 > EOS
71 71
72 72 Add a symlink and executable file:
73 73 $ hg up -C c
74 74 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 75 $ ln -s somefile e
76 76 $ echo f > f
77 77 $ chmod +x f
78 78 $ hg add e f
79 79 $ hg amend -q
80 80 $ hg up -Cq a
81 81
82 82 Write files to the working copy, and ensure they're still there after the rebase
83 83 $ echo "abc" > a
84 84 $ ln -s def b
85 85 $ echo "ghi" > c
86 86 $ echo "jkl" > d
87 87 $ echo "mno" > e
88 88 $ hg tglog
89 89 o 3: f56b71190a8f 'c'
90 90 |
91 91 | o 2: db0e82a16a62 'b'
92 92 |/
93 93 o 1: 02952614a83d 'd'
94 94 |
95 95 @ 0: b173517d0057 'a'
96 96
97 97 $ hg cat -r 3 c
98 98 c (no-eol)
99 99 $ hg cat -r 2 b
100 100 b (no-eol)
101 101 $ hg cat -r 3 e
102 102 somefile (no-eol)
103 103 $ hg rebase --debug -s b -d a | grep rebasing
104 104 rebasing in-memory
105 105 rebasing 2:db0e82a16a62 "b" (b)
106 106 $ hg tglog
107 107 o 3: fc055c3b4d33 'b'
108 108 |
109 109 | o 2: f56b71190a8f 'c'
110 110 | |
111 111 | o 1: 02952614a83d 'd'
112 112 |/
113 113 @ 0: b173517d0057 'a'
114 114
115 115 $ hg cat -r 2 c
116 116 c (no-eol)
117 117 $ hg cat -r 3 b
118 118 b (no-eol)
119 119 $ hg rebase --debug -s 1 -d 3 | grep rebasing
120 120 rebasing in-memory
121 121 rebasing 1:02952614a83d "d" (d)
122 122 rebasing 2:f56b71190a8f "c"
123 123 $ hg tglog
124 124 o 3: 753feb6fd12a 'c'
125 125 |
126 126 o 2: 09c044d2cb43 'd'
127 127 |
128 128 o 1: fc055c3b4d33 'b'
129 129 |
130 130 @ 0: b173517d0057 'a'
131 131
132 132 Ensure working copy files are still there:
133 133 $ cat a
134 134 abc
135 135 $ readlink.py b
136 136 b -> def
137 137 $ cat e
138 138 mno
139 139
140 140 Ensure symlink and executable files were rebased properly:
141 141 $ hg up -Cq 3
142 142 $ readlink.py e
143 143 e -> somefile
144 144 $ ls -l f | cut -c -10
145 145 -rwxr-xr-x
146 146
147 147 Rebase the working copy parent
148 148 $ hg up -C 3
149 149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 150 $ hg rebase -r 3 -d 0 --debug | grep rebasing
151 151 rebasing in-memory
152 152 rebasing 3:753feb6fd12a "c" (tip)
153 153 $ hg tglog
154 154 @ 3: 844a7de3e617 'c'
155 155 |
156 156 | o 2: 09c044d2cb43 'd'
157 157 | |
158 158 | o 1: fc055c3b4d33 'b'
159 159 |/
160 160 o 0: b173517d0057 'a'
161 161
162 162
163 163 Test reporting of path conflicts
164 164
165 165 $ hg rm a
166 166 $ mkdir a
167 167 $ touch a/a
168 168 $ hg ci -Am "a/a"
169 169 adding a/a
170 170 $ hg tglog
171 171 @ 4: daf7dfc139cb 'a/a'
172 172 |
173 173 o 3: 844a7de3e617 'c'
174 174 |
175 175 | o 2: 09c044d2cb43 'd'
176 176 | |
177 177 | o 1: fc055c3b4d33 'b'
178 178 |/
179 179 o 0: b173517d0057 'a'
180 180
181 181 $ hg rebase -r . -d 2
182 182 rebasing 4:daf7dfc139cb "a/a" (tip)
183 183 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/daf7dfc139cb-fdbfcf4f-rebase.hg
184 184
185 185 $ hg tglog
186 186 @ 4: c6ad37a4f250 'a/a'
187 187 |
188 188 | o 3: 844a7de3e617 'c'
189 189 | |
190 190 o | 2: 09c044d2cb43 'd'
191 191 | |
192 192 o | 1: fc055c3b4d33 'b'
193 193 |/
194 194 o 0: b173517d0057 'a'
195 195
196 196 $ echo foo > foo
197 197 $ hg ci -Aqm "added foo"
198 198 $ hg up '.^'
199 199 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
200 200 $ echo bar > bar
201 201 $ hg ci -Aqm "added bar"
202 202 $ hg rm a/a
203 203 $ echo a > a
204 204 $ hg ci -Aqm "added a back!"
205 205 $ hg tglog
206 206 @ 7: 855e9797387e 'added a back!'
207 207 |
208 208 o 6: d14530e5e3e6 'added bar'
209 209 |
210 210 | o 5: 9b94b9373deb 'added foo'
211 211 |/
212 212 o 4: c6ad37a4f250 'a/a'
213 213 |
214 214 | o 3: 844a7de3e617 'c'
215 215 | |
216 216 o | 2: 09c044d2cb43 'd'
217 217 | |
218 218 o | 1: fc055c3b4d33 'b'
219 219 |/
220 220 o 0: b173517d0057 'a'
221 221
222 222 $ hg rebase -r . -d 5
223 223 rebasing 7:855e9797387e "added a back!" (tip)
224 224 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/855e9797387e-81ee4c5d-rebase.hg
225 225
226 226 $ hg tglog
227 227 @ 7: bb3f02be2688 'added a back!'
228 228 |
229 229 | o 6: d14530e5e3e6 'added bar'
230 230 | |
231 231 o | 5: 9b94b9373deb 'added foo'
232 232 |/
233 233 o 4: c6ad37a4f250 'a/a'
234 234 |
235 235 | o 3: 844a7de3e617 'c'
236 236 | |
237 237 o | 2: 09c044d2cb43 'd'
238 238 | |
239 239 o | 1: fc055c3b4d33 'b'
240 240 |/
241 241 o 0: b173517d0057 'a'
242 242
243 243 $ mkdir -p c/subdir
244 244 $ echo c > c/subdir/file.txt
245 245 $ hg add c/subdir/file.txt
246 246 $ hg ci -m 'c/subdir/file.txt'
247 247 $ hg rebase -r . -d 3 -n
248 248 starting dry-run rebase; repository will not be changed
249 249 rebasing 8:e147e6e3c490 "c/subdir/file.txt" (tip)
250 250 abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3.
251 251 [255]
252 252 FIXME: shouldn't need this, but when we hit path conflicts in dryrun mode, we
253 253 don't clean up rebasestate.
254 254 $ hg rebase --abort
255 255 rebase aborted
256 256 $ hg rebase -r 3 -d . -n
257 257 starting dry-run rebase; repository will not be changed
258 258 rebasing 3:844a7de3e617 "c"
259 259 abort: error: file 'c' cannot be written because 'c/' is a directory in e147e6e3c490 (containing 1 entries: c/subdir/file.txt)
260 260 [255]
261 261
262 262 $ cd ..
263 263
264 264 Test path auditing (issue5818)
265 265
266 266 $ mkdir lib_
267 267 $ ln -s lib_ lib
268 268 $ hg init repo
269 269 $ cd repo
270 270 $ mkdir -p ".$TESTTMP/lib"
271 271 $ touch ".$TESTTMP/lib/a"
272 272 $ hg add ".$TESTTMP/lib/a"
273 273 $ hg ci -m 'a'
274 274
275 275 $ touch ".$TESTTMP/lib/b"
276 276 $ hg add ".$TESTTMP/lib/b"
277 277 $ hg ci -m 'b'
278 278
279 279 $ hg up -q '.^'
280 280 $ touch ".$TESTTMP/lib/c"
281 281 $ hg add ".$TESTTMP/lib/c"
282 282 $ hg ci -m 'c'
283 283 created new head
284 284 $ hg rebase -s 1 -d .
285 285 rebasing 1:* "b" (glob)
286 286 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
287 287 $ cd ..
288 288
289 289 Test dry-run rebasing
290 290
291 291 $ hg init repo3
292 292 $ cd repo3
293 293 $ echo a>a
294 294 $ hg ci -Aqma
295 295 $ echo b>b
296 296 $ hg ci -Aqmb
297 297 $ echo c>c
298 298 $ hg ci -Aqmc
299 299 $ echo d>d
300 300 $ hg ci -Aqmd
301 301 $ echo e>e
302 302 $ hg ci -Aqme
303 303
304 304 $ hg up 1 -q
305 305 $ echo f>f
306 306 $ hg ci -Amf
307 307 adding f
308 308 created new head
309 309 $ echo g>g
310 310 $ hg ci -Aqmg
311 311 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
312 312 @ 6:baf10c5166d4 test
313 313 | g
314 314 |
315 315 o 5:6343ca3eff20 test
316 316 | f
317 317 |
318 318 | o 4:e860deea161a test
319 319 | | e
320 320 | |
321 321 | o 3:055a42cdd887 test
322 322 | | d
323 323 | |
324 324 | o 2:177f92b77385 test
325 325 |/ c
326 326 |
327 327 o 1:d2ae7f538514 test
328 328 | b
329 329 |
330 330 o 0:cb9a9f314b8b test
331 331 a
332 332
333 333 Make sure it throws error while passing --continue or --abort with --dry-run
334 334 $ hg rebase -s 2 -d 6 -n --continue
335 335 abort: cannot specify both --continue and --dry-run
336 336 [255]
337 337 $ hg rebase -s 2 -d 6 -n --abort
338 338 abort: cannot specify both --abort and --dry-run
339 339 [255]
340 340
341 341 Check dryrun gives correct results when there is no conflict in rebasing
342 342 $ hg rebase -s 2 -d 6 -n
343 343 starting dry-run rebase; repository will not be changed
344 344 rebasing 2:177f92b77385 "c"
345 345 rebasing 3:055a42cdd887 "d"
346 346 rebasing 4:e860deea161a "e"
347 347 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
348 348
349 349 $ hg diff
350 350 $ hg status
351 351
352 352 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
353 353 @ 6:baf10c5166d4 test
354 354 | g
355 355 |
356 356 o 5:6343ca3eff20 test
357 357 | f
358 358 |
359 359 | o 4:e860deea161a test
360 360 | | e
361 361 | |
362 362 | o 3:055a42cdd887 test
363 363 | | d
364 364 | |
365 365 | o 2:177f92b77385 test
366 366 |/ c
367 367 |
368 368 o 1:d2ae7f538514 test
369 369 | b
370 370 |
371 371 o 0:cb9a9f314b8b test
372 372 a
373 373
374 374 Check dryrun working with --collapse when there is no conflict
375 375 $ hg rebase -s 2 -d 6 -n --collapse
376 376 starting dry-run rebase; repository will not be changed
377 377 rebasing 2:177f92b77385 "c"
378 378 rebasing 3:055a42cdd887 "d"
379 379 rebasing 4:e860deea161a "e"
380 380 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
381 381
382 382 Check dryrun gives correct results when there is conflict in rebasing
383 383 Make a conflict:
384 384 $ hg up 6 -q
385 385 $ echo conflict>e
386 386 $ hg ci -Aqm "conflict with e"
387 387 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
388 388 @ 7:d2c195b28050 test
389 389 | conflict with e
390 390 |
391 391 o 6:baf10c5166d4 test
392 392 | g
393 393 |
394 394 o 5:6343ca3eff20 test
395 395 | f
396 396 |
397 397 | o 4:e860deea161a test
398 398 | | e
399 399 | |
400 400 | o 3:055a42cdd887 test
401 401 | | d
402 402 | |
403 403 | o 2:177f92b77385 test
404 404 |/ c
405 405 |
406 406 o 1:d2ae7f538514 test
407 407 | b
408 408 |
409 409 o 0:cb9a9f314b8b test
410 410 a
411 411
412 412 $ hg rebase -s 2 -d 7 -n
413 413 starting dry-run rebase; repository will not be changed
414 414 rebasing 2:177f92b77385 "c"
415 415 rebasing 3:055a42cdd887 "d"
416 416 rebasing 4:e860deea161a "e"
417 417 merging e
418 418 transaction abort!
419 419 rollback completed
420 420 hit a merge conflict
421 421 [1]
422 422 $ hg diff
423 423 $ hg status
424 424 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
425 425 @ 7:d2c195b28050 test
426 426 | conflict with e
427 427 |
428 428 o 6:baf10c5166d4 test
429 429 | g
430 430 |
431 431 o 5:6343ca3eff20 test
432 432 | f
433 433 |
434 434 | o 4:e860deea161a test
435 435 | | e
436 436 | |
437 437 | o 3:055a42cdd887 test
438 438 | | d
439 439 | |
440 440 | o 2:177f92b77385 test
441 441 |/ c
442 442 |
443 443 o 1:d2ae7f538514 test
444 444 | b
445 445 |
446 446 o 0:cb9a9f314b8b test
447 447 a
448 448
449 449 Check dryrun working with --collapse when there is conflicts
450 450 $ hg rebase -s 2 -d 7 -n --collapse
451 451 starting dry-run rebase; repository will not be changed
452 452 rebasing 2:177f92b77385 "c"
453 453 rebasing 3:055a42cdd887 "d"
454 454 rebasing 4:e860deea161a "e"
455 455 merging e
456 456 hit a merge conflict
457 457 [1]
458 458
459 459 In-memory rebase that fails due to merge conflicts
460 460
461 461 $ hg rebase -s 2 -d 7
462 462 rebasing 2:177f92b77385 "c"
463 463 rebasing 3:055a42cdd887 "d"
464 464 rebasing 4:e860deea161a "e"
465 465 merging e
466 466 transaction abort!
467 467 rollback completed
468 468 hit merge conflicts; re-running rebase without in-memory merge
469 469 rebasing 2:177f92b77385 "c"
470 470 rebasing 3:055a42cdd887 "d"
471 471 rebasing 4:e860deea161a "e"
472 472 merging e
473 473 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
474 474 unresolved conflicts (see hg resolve, then hg rebase --continue)
475 475 [1]
476 476 $ hg rebase --abort
477 477 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
478 478 rebase aborted
479 479
480 480 Retrying without in-memory merge won't lose working copy changes
481 481 $ cd ..
482 482 $ hg clone repo3 repo3-dirty -q
483 483 $ cd repo3-dirty
484 484 $ echo dirty > a
485 485 $ hg rebase -s 2 -d 7
486 486 rebasing 2:177f92b77385 "c"
487 487 rebasing 3:055a42cdd887 "d"
488 488 rebasing 4:e860deea161a "e"
489 489 merging e
490 490 transaction abort!
491 491 rollback completed
492 492 hit merge conflicts; re-running rebase without in-memory merge
493 493 abort: uncommitted changes
494 494 [255]
495 495 $ cat a
496 496 dirty
497 497
498 498 Retrying without in-memory merge won't lose merge state
499 499 $ cd ..
500 500 $ hg clone repo3 repo3-merge-state -q
501 501 $ cd repo3-merge-state
502 502 $ hg merge 4
503 503 merging e
504 504 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
505 505 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
506 506 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
507 507 [1]
508 508 $ hg resolve -l
509 509 U e
510 510 $ hg rebase -s 2 -d 7
511 511 abort: outstanding uncommitted merge
512 512 (use 'hg commit' or 'hg merge --abort')
513 513 [255]
514 514 $ hg resolve -l
515 515 U e
516 516
517 517 ==========================
518 518 Test for --confirm option|
519 519 ==========================
520 520 $ cd ..
521 521 $ hg clone repo3 repo4 -q
522 522 $ cd repo4
523 523 $ hg strip 7 -q
524 524 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
525 525 @ 6:baf10c5166d4 test
526 526 | g
527 527 |
528 528 o 5:6343ca3eff20 test
529 529 | f
530 530 |
531 531 | o 4:e860deea161a test
532 532 | | e
533 533 | |
534 534 | o 3:055a42cdd887 test
535 535 | | d
536 536 | |
537 537 | o 2:177f92b77385 test
538 538 |/ c
539 539 |
540 540 o 1:d2ae7f538514 test
541 541 | b
542 542 |
543 543 o 0:cb9a9f314b8b test
544 544 a
545 545
546 546 Check it gives error when both --dryrun and --confirm is used:
547 547 $ hg rebase -s 2 -d . --confirm --dry-run
548 548 abort: cannot specify both --confirm and --dry-run
549 549 [255]
550 550 $ hg rebase -s 2 -d . --confirm --abort
551 551 abort: cannot specify both --abort and --confirm
552 552 [255]
553 553 $ hg rebase -s 2 -d . --confirm --continue
554 554 abort: cannot specify both --continue and --confirm
555 555 [255]
556 556
557 557 Test --confirm option when there are no conflicts:
558 558 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
559 559 > n
560 560 > EOF
561 561 starting in-memory rebase
562 562 rebasing 2:177f92b77385 "c"
563 563 rebasing 3:055a42cdd887 "d"
564 564 rebasing 4:e860deea161a "e"
565 565 rebase completed successfully
566 566 apply changes (yn)? n
567 567 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
568 568 @ 6:baf10c5166d4 test
569 569 | g
570 570 |
571 571 o 5:6343ca3eff20 test
572 572 | f
573 573 |
574 574 | o 4:e860deea161a test
575 575 | | e
576 576 | |
577 577 | o 3:055a42cdd887 test
578 578 | | d
579 579 | |
580 580 | o 2:177f92b77385 test
581 581 |/ c
582 582 |
583 583 o 1:d2ae7f538514 test
584 584 | b
585 585 |
586 586 o 0:cb9a9f314b8b test
587 587 a
588 588
589 589 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
590 590 > y
591 591 > EOF
592 592 starting in-memory rebase
593 593 rebasing 2:177f92b77385 "c"
594 594 rebasing 3:055a42cdd887 "d"
595 595 rebasing 4:e860deea161a "e"
596 596 rebase completed successfully
597 597 apply changes (yn)? y
598 598 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
599 599 o 9:9fd28f55f6dc test
600 600 | e
601 601 |
602 602 o 8:12cbf031f469 test
603 603 | d
604 604 |
605 605 o 7:c83b1da5b1ae test
606 606 | c
607 607 |
608 608 @ 6:baf10c5166d4 test
609 609 | g
610 610 |
611 611 o 5:6343ca3eff20 test
612 612 | f
613 613 |
614 614 | o 4:e860deea161a test
615 615 | | e
616 616 | |
617 617 | o 3:055a42cdd887 test
618 618 | | d
619 619 | |
620 620 | o 2:177f92b77385 test
621 621 |/ c
622 622 |
623 623 o 1:d2ae7f538514 test
624 624 | b
625 625 |
626 626 o 0:cb9a9f314b8b test
627 627 a
628 628
629 629 Test --confirm option when there is a conflict
630 630 $ hg up tip -q
631 631 $ echo ee>e
632 632 $ hg ci --amend -m "conflict with e" -q
633 633 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
634 634 @ 9:906d72f66a59 test
635 635 | conflict with e
636 636 |
637 637 o 8:12cbf031f469 test
638 638 | d
639 639 |
640 640 o 7:c83b1da5b1ae test
641 641 | c
642 642 |
643 643 o 6:baf10c5166d4 test
644 644 | g
645 645 |
646 646 o 5:6343ca3eff20 test
647 647 | f
648 648 |
649 649 | o 4:e860deea161a test
650 650 | | e
651 651 | |
652 652 | o 3:055a42cdd887 test
653 653 | | d
654 654 | |
655 655 | o 2:177f92b77385 test
656 656 |/ c
657 657 |
658 658 o 1:d2ae7f538514 test
659 659 | b
660 660 |
661 661 o 0:cb9a9f314b8b test
662 662 a
663 663
664 664 $ hg rebase -s 4 -d . --keep --confirm
665 665 starting in-memory rebase
666 666 rebasing 4:e860deea161a "e"
667 667 merging e
668 668 hit a merge conflict
669 669 [1]
670 670 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
671 671 @ 9:906d72f66a59 test
672 672 | conflict with e
673 673 |
674 674 o 8:12cbf031f469 test
675 675 | d
676 676 |
677 677 o 7:c83b1da5b1ae test
678 678 | c
679 679 |
680 680 o 6:baf10c5166d4 test
681 681 | g
682 682 |
683 683 o 5:6343ca3eff20 test
684 684 | f
685 685 |
686 686 | o 4:e860deea161a test
687 687 | | e
688 688 | |
689 689 | o 3:055a42cdd887 test
690 690 | | d
691 691 | |
692 692 | o 2:177f92b77385 test
693 693 |/ c
694 694 |
695 695 o 1:d2ae7f538514 test
696 696 | b
697 697 |
698 698 o 0:cb9a9f314b8b test
699 699 a
700 700
701 701 Test a metadata-only in-memory merge
702 702 $ cd $TESTTMP
703 703 $ hg init no_exception
704 704 $ cd no_exception
705 705 # Produce the following graph:
706 706 # o 'add +x to foo.txt'
707 707 # | o r1 (adds bar.txt, just for something to rebase to)
708 708 # |/
709 709 # o r0 (adds foo.txt, no +x)
710 710 $ echo hi > foo.txt
711 711 $ hg ci -qAm r0
712 712 $ echo hi > bar.txt
713 713 $ hg ci -qAm r1
714 714 $ hg co -qr ".^"
715 715 $ chmod +x foo.txt
716 716 $ hg ci -qAm 'add +x to foo.txt'
717 717 issue5960: this was raising an AttributeError exception
718 718 $ hg rebase -r . -d 1
719 719 rebasing 2:539b93e77479 "add +x to foo.txt" (tip)
720 720 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
721 721 $ hg diff -c tip
722 722 diff --git a/foo.txt b/foo.txt
723 723 old mode 100644
724 724 new mode 100755
725 725
726 726 Test rebasing a commit with copy information, but no content changes
727 727
728 728 $ cd ..
729 729 $ hg clone -q repo1 merge-and-rename
730 730 $ cd merge-and-rename
731 731 $ cat << EOF >> .hg/hgrc
732 732 > [experimental]
733 733 > evolution.createmarkers=True
734 734 > evolution.allowunstable=True
735 735 > EOF
736 736 $ hg co -q 1
737 737 $ hg mv d e
738 738 $ hg ci -qm 'rename d to e'
739 739 $ hg co -q 3
740 740 $ hg merge -q 4
741 741 $ hg ci -m 'merge'
742 742 $ hg co -q 2
743 743 $ mv d e
744 744 $ hg addremove -qs 0
745 745 $ hg ci -qm 'untracked rename of d to e'
746 746 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
747 747 1 new orphan changesets
748 748 $ hg tglog
749 749 @ 6: 676538af172d 'untracked rename of d to e'
750 750 |
751 751 | * 5: 574d92ad16fc 'merge'
752 752 | |\
753 753 | | x 4: 2c8b5dad7956 'rename d to e'
754 754 | | |
755 755 | o | 3: ca58782ad1e4 'b'
756 756 |/ /
757 757 o / 2: 814f6bd05178 'c'
758 758 |/
759 759 o 1: 02952614a83d 'd'
760 760 |
761 761 o 0: b173517d0057 'a'
762 762
763 763 $ hg rebase -b 5 -d tip
764 764 rebasing 3:ca58782ad1e4 "b"
765 765 rebasing 5:574d92ad16fc "merge"
766 766 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
767 767
768 768 $ cd ..
769 769
770 770 Test rebasing a commit with copy information
771 771
772 772 $ hg init rebase-rename
773 773 $ cd rebase-rename
774 774 $ echo a > a
775 775 $ hg ci -Aqm 'add a'
776 776 $ echo a2 > a
777 777 $ hg ci -m 'modify a'
778 778 $ hg co -q 0
779 779 $ hg mv a b
780 780 $ hg ci -qm 'rename a to b'
781 781 $ hg rebase -d 1
782 782 rebasing 2:b977edf6f839 "rename a to b" (tip)
783 783 merging a and b to b
784 784 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
785 785 $ hg st --copies --change .
786 786 A b
787 787 a
788 788 R a
789 789 $ cd ..
790 790
791 791 Test rebasing a commit with copy information, where the target is empty
792 792
793 793 $ hg init rebase-rename-empty
794 794 $ cd rebase-rename-empty
795 795 $ echo a > a
796 796 $ hg ci -Aqm 'add a'
797 797 $ cat > a
798 798 $ hg ci -m 'make a empty'
799 799 $ hg co -q 0
800 800 $ hg mv a b
801 801 $ hg ci -qm 'rename a to b'
802 802 $ hg rebase -d 1
803 803 rebasing 2:b977edf6f839 "rename a to b" (tip)
804 804 merging a and b to b
805 805 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
806 806 $ hg st --copies --change .
807 807 A b
808 808 a
809 809 R a
810 810 $ cd ..
811 811 Rebase across a copy with --collapse
812 812
813 813 $ hg init rebase-rename-collapse
814 814 $ cd rebase-rename-collapse
815 815 $ echo a > a
816 816 $ hg ci -Aqm 'add a'
817 817 $ hg mv a b
818 818 $ hg ci -m 'rename a to b'
819 819 $ hg co -q 0
820 820 $ echo a2 > a
821 821 $ hg ci -qm 'modify a'
822 822 $ hg rebase -r . -d 1 --collapse
823 823 rebasing 2:41c4ea50d4cf "modify a" (tip)
824 824 merging b and a to b
825 825 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
826 826 $ cd ..
827 827
828 828 Test rebasing when the file we are merging in destination is empty
829 829
830 830 $ hg init test
831 831 $ cd test
832 832 $ echo a > foo
833 833 $ hg ci -Aqm 'added a to foo'
834 834
835 835 $ rm foo
836 836 $ touch foo
837 837 $ hg di
838 838 diff --git a/foo b/foo
839 839 --- a/foo
840 840 +++ b/foo
841 841 @@ -1,1 +0,0 @@
842 842 -a
843 843
844 844 $ hg ci -m "make foo an empty file"
845 845
846 846 $ hg up '.^'
847 847 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 848 $ echo b > foo
849 849 $ hg di
850 850 diff --git a/foo b/foo
851 851 --- a/foo
852 852 +++ b/foo
853 853 @@ -1,1 +1,1 @@
854 854 -a
855 855 +b
856 856 $ hg ci -m "add b to foo"
857 857 created new head
858 858
859 859 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
860 860 rebasing 2:fb62b706688e "add b to foo" (tip)
861 861 merging foo
862 862 hit merge conflicts; re-running rebase without in-memory merge
863 863 rebasing 2:fb62b706688e "add b to foo" (tip)
864 864 merging foo
865 865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
866 866 unresolved conflicts (see hg resolve, then hg rebase --continue)
867 867 [1]
868 868
869 869 $ cd $TESTTMP
870 870
871 871 Test rebasing when we're in the middle of a rebase already
872 872 $ hg init test_issue6214
873 873 $ cd test_issue6214
874 874 $ echo r0 > r0
875 875 $ hg ci -qAm 'r0'
876 876 $ echo hi > foo
877 877 $ hg ci -qAm 'hi from foo'
878 878 $ hg co -q '.^'
879 879 $ echo bye > foo
880 880 $ hg ci -qAm 'bye from foo'
881 881 $ hg co -q '.^'
882 882 $ echo unrelated > some_other_file
883 883 $ hg ci -qAm 'some unrelated changes'
884 884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
885 885 @ 3: some unrelated changes
886 886 | some_other_file
887 887 | o 2: bye from foo
888 888 |/ foo
889 889 | o 1: hi from foo
890 890 |/ foo
891 891 o 0: r0
892 892 r0
893 893 $ hg rebase -r 2 -d 1 -t:merge3
894 894 rebasing 2:b4d249fbf8dd "bye from foo"
895 895 merging foo
896 896 hit merge conflicts; re-running rebase without in-memory merge
897 897 rebasing 2:b4d249fbf8dd "bye from foo"
898 898 merging foo
899 899 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
900 900 unresolved conflicts (see hg resolve, then hg rebase --continue)
901 901 [1]
902 902 $ hg rebase -r 3 -d 1 -t:merge3
903 903 abort: rebase in progress
904 904 (use 'hg rebase --continue' or 'hg rebase --abort')
905 905 [255]
906 906 $ hg resolve --list
907 907 U foo
908 908 $ hg resolve --all --re-merge -t:other
909 909 (no more unresolved files)
910 910 continue: hg rebase --continue
911 911 $ hg rebase --continue
912 912 rebasing 2:b4d249fbf8dd "bye from foo"
913 913 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
914 914 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
915 915 o 3: bye from foo
916 916 | foo
917 917 | @ 2: some unrelated changes
918 918 | | some_other_file
919 919 o | 1: hi from foo
920 920 |/ foo
921 921 o 0: r0
922 922 r0
923
924 $ cd ..
925
926 Changesets that become empty should not be committed. Merges are not empty by
927 definition.
928
929 $ hg init keep_merge
930 $ cd keep_merge
931 $ echo base > base; hg add base; hg ci -m base
932 $ echo test > test; hg add test; hg ci -m a
933 $ hg up 0 -q
934 $ echo test > test; hg add test; hg ci -m b -q
935 $ hg up 0 -q
936 $ echo test > test; hg add test; hg ci -m c -q
937 $ hg up 1 -q
938 $ hg merge 2 -q
939 $ hg ci -m merge
940 $ hg up null -q
941 $ hg tglog
942 o 4: 59c8292117b1 'merge'
943 |\
944 | | o 3: 531f80391e4a 'c'
945 | | |
946 | o | 2: 0194f1db184a 'b'
947 | |/
948 o / 1: 6f252845ea45 'a'
949 |/
950 o 0: d20a80d4def3 'base'
951
952 FIXME: It's broken for inmemory merges.
953 $ hg rebase -s 2 -d 3
954 rebasing 2:0194f1db184a "b"
955 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
956 rebasing 4:59c8292117b1 "merge" (tip)
957 note: not rebasing 4:59c8292117b1 "merge" (tip), its destination already has all its changes (true !)
958 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
959 #if false
960 $ hg tglog
961 o 3: 506e2454484b 'merge'
962 |\
963 | o 2: 531f80391e4a 'c'
964 | |
965 o | 1: 6f252845ea45 'a'
966 |/
967 o 0: d20a80d4def3 'base'
968
969 #endif
General Comments 0
You need to be logged in to leave comments. Login now