##// END OF EJS Templates
tests: show that in-memory rebase leaves state when working copy is dirty...
Martin von Zweigbergk -
r46640:39e2cf7c stable
parent child Browse files
Show More
@@ -1,974 +1,982
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 hit a merge conflict
419 419 [1]
420 420 $ hg diff
421 421 $ hg status
422 422 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
423 423 @ 7:d2c195b28050 test
424 424 | conflict with e
425 425 |
426 426 o 6:baf10c5166d4 test
427 427 | g
428 428 |
429 429 o 5:6343ca3eff20 test
430 430 | f
431 431 |
432 432 | o 4:e860deea161a test
433 433 | | e
434 434 | |
435 435 | o 3:055a42cdd887 test
436 436 | | d
437 437 | |
438 438 | o 2:177f92b77385 test
439 439 |/ c
440 440 |
441 441 o 1:d2ae7f538514 test
442 442 | b
443 443 |
444 444 o 0:cb9a9f314b8b test
445 445 a
446 446
447 447 Check dryrun working with --collapse when there is conflicts
448 448 $ hg rebase -s 2 -d 7 -n --collapse
449 449 starting dry-run rebase; repository will not be changed
450 450 rebasing 2:177f92b77385 "c"
451 451 rebasing 3:055a42cdd887 "d"
452 452 rebasing 4:e860deea161a "e"
453 453 merging e
454 454 hit a merge conflict
455 455 [1]
456 456
457 457 In-memory rebase that fails due to merge conflicts
458 458
459 459 $ hg rebase -s 2 -d 7
460 460 rebasing 2:177f92b77385 "c"
461 461 rebasing 3:055a42cdd887 "d"
462 462 rebasing 4:e860deea161a "e"
463 463 merging e
464 464 hit merge conflicts; rebasing that commit again in the working copy
465 465 merging e
466 466 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
467 467 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
468 468 [1]
469 469 $ hg rebase --abort
470 470 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
471 471 rebase aborted
472 472
473 473 Retrying without in-memory merge won't lose working copy changes
474 474 $ cd ..
475 475 $ hg clone repo3 repo3-dirty -q
476 476 $ cd repo3-dirty
477 477 $ echo dirty > a
478 478 $ hg rebase -s 2 -d 7
479 479 rebasing 2:177f92b77385 "c"
480 480 rebasing 3:055a42cdd887 "d"
481 481 rebasing 4:e860deea161a "e"
482 482 merging e
483 483 hit merge conflicts; rebasing that commit again in the working copy
484 484 transaction abort!
485 485 rollback completed
486 486 abort: uncommitted changes
487 487 [255]
488 488 $ cat a
489 489 dirty
490 $ hg status -v
491 M a
492 # The repository is in an unfinished *rebase* state.
493
494 # To continue: hg rebase --continue
495 # To abort: hg rebase --abort
496 # To stop: hg rebase --stop
497
490 498
491 499 Retrying without in-memory merge won't lose merge state
492 500 $ cd ..
493 501 $ hg clone repo3 repo3-merge-state -q
494 502 $ cd repo3-merge-state
495 503 $ hg merge 4
496 504 merging e
497 505 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
498 506 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
499 507 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
500 508 [1]
501 509 $ hg resolve -l
502 510 U e
503 511 $ hg rebase -s 2 -d 7
504 512 abort: outstanding uncommitted merge
505 513 (use 'hg commit' or 'hg merge --abort')
506 514 [255]
507 515 $ hg resolve -l
508 516 U e
509 517
510 518 ==========================
511 519 Test for --confirm option|
512 520 ==========================
513 521 $ cd ..
514 522 $ hg clone repo3 repo4 -q
515 523 $ cd repo4
516 524 $ hg strip 7 -q
517 525 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
518 526 @ 6:baf10c5166d4 test
519 527 | g
520 528 |
521 529 o 5:6343ca3eff20 test
522 530 | f
523 531 |
524 532 | o 4:e860deea161a test
525 533 | | e
526 534 | |
527 535 | o 3:055a42cdd887 test
528 536 | | d
529 537 | |
530 538 | o 2:177f92b77385 test
531 539 |/ c
532 540 |
533 541 o 1:d2ae7f538514 test
534 542 | b
535 543 |
536 544 o 0:cb9a9f314b8b test
537 545 a
538 546
539 547 Check it gives error when both --dryrun and --confirm is used:
540 548 $ hg rebase -s 2 -d . --confirm --dry-run
541 549 abort: cannot specify both --confirm and --dry-run
542 550 [255]
543 551 $ hg rebase -s 2 -d . --confirm --abort
544 552 abort: cannot specify both --abort and --confirm
545 553 [255]
546 554 $ hg rebase -s 2 -d . --confirm --continue
547 555 abort: cannot specify both --continue and --confirm
548 556 [255]
549 557
550 558 Test --confirm option when there are no conflicts:
551 559 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
552 560 > n
553 561 > EOF
554 562 starting in-memory rebase
555 563 rebasing 2:177f92b77385 "c"
556 564 rebasing 3:055a42cdd887 "d"
557 565 rebasing 4:e860deea161a "e"
558 566 rebase completed successfully
559 567 apply changes (yn)? n
560 568 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
561 569 @ 6:baf10c5166d4 test
562 570 | g
563 571 |
564 572 o 5:6343ca3eff20 test
565 573 | f
566 574 |
567 575 | o 4:e860deea161a test
568 576 | | e
569 577 | |
570 578 | o 3:055a42cdd887 test
571 579 | | d
572 580 | |
573 581 | o 2:177f92b77385 test
574 582 |/ c
575 583 |
576 584 o 1:d2ae7f538514 test
577 585 | b
578 586 |
579 587 o 0:cb9a9f314b8b test
580 588 a
581 589
582 590 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
583 591 > y
584 592 > EOF
585 593 starting in-memory rebase
586 594 rebasing 2:177f92b77385 "c"
587 595 rebasing 3:055a42cdd887 "d"
588 596 rebasing 4:e860deea161a "e"
589 597 rebase completed successfully
590 598 apply changes (yn)? y
591 599 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
592 600 o 9:9fd28f55f6dc test
593 601 | e
594 602 |
595 603 o 8:12cbf031f469 test
596 604 | d
597 605 |
598 606 o 7:c83b1da5b1ae test
599 607 | c
600 608 |
601 609 @ 6:baf10c5166d4 test
602 610 | g
603 611 |
604 612 o 5:6343ca3eff20 test
605 613 | f
606 614 |
607 615 | o 4:e860deea161a test
608 616 | | e
609 617 | |
610 618 | o 3:055a42cdd887 test
611 619 | | d
612 620 | |
613 621 | o 2:177f92b77385 test
614 622 |/ c
615 623 |
616 624 o 1:d2ae7f538514 test
617 625 | b
618 626 |
619 627 o 0:cb9a9f314b8b test
620 628 a
621 629
622 630 Test --confirm option when there is a conflict
623 631 $ hg up tip -q
624 632 $ echo ee>e
625 633 $ hg ci --amend -m "conflict with e" -q
626 634 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
627 635 @ 9:906d72f66a59 test
628 636 | conflict with e
629 637 |
630 638 o 8:12cbf031f469 test
631 639 | d
632 640 |
633 641 o 7:c83b1da5b1ae test
634 642 | c
635 643 |
636 644 o 6:baf10c5166d4 test
637 645 | g
638 646 |
639 647 o 5:6343ca3eff20 test
640 648 | f
641 649 |
642 650 | o 4:e860deea161a test
643 651 | | e
644 652 | |
645 653 | o 3:055a42cdd887 test
646 654 | | d
647 655 | |
648 656 | o 2:177f92b77385 test
649 657 |/ c
650 658 |
651 659 o 1:d2ae7f538514 test
652 660 | b
653 661 |
654 662 o 0:cb9a9f314b8b test
655 663 a
656 664
657 665 $ hg rebase -s 4 -d . --keep --confirm
658 666 starting in-memory rebase
659 667 rebasing 4:e860deea161a "e"
660 668 merging e
661 669 hit a merge conflict
662 670 [1]
663 671 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
664 672 @ 9:906d72f66a59 test
665 673 | conflict with e
666 674 |
667 675 o 8:12cbf031f469 test
668 676 | d
669 677 |
670 678 o 7:c83b1da5b1ae test
671 679 | c
672 680 |
673 681 o 6:baf10c5166d4 test
674 682 | g
675 683 |
676 684 o 5:6343ca3eff20 test
677 685 | f
678 686 |
679 687 | o 4:e860deea161a test
680 688 | | e
681 689 | |
682 690 | o 3:055a42cdd887 test
683 691 | | d
684 692 | |
685 693 | o 2:177f92b77385 test
686 694 |/ c
687 695 |
688 696 o 1:d2ae7f538514 test
689 697 | b
690 698 |
691 699 o 0:cb9a9f314b8b test
692 700 a
693 701
694 702 Test a metadata-only in-memory merge
695 703 $ cd $TESTTMP
696 704 $ hg init no_exception
697 705 $ cd no_exception
698 706 # Produce the following graph:
699 707 # o 'add +x to foo.txt'
700 708 # | o r1 (adds bar.txt, just for something to rebase to)
701 709 # |/
702 710 # o r0 (adds foo.txt, no +x)
703 711 $ echo hi > foo.txt
704 712 $ hg ci -qAm r0
705 713 $ echo hi > bar.txt
706 714 $ hg ci -qAm r1
707 715 $ hg co -qr ".^"
708 716 $ chmod +x foo.txt
709 717 $ hg ci -qAm 'add +x to foo.txt'
710 718 issue5960: this was raising an AttributeError exception
711 719 $ hg rebase -r . -d 1
712 720 rebasing 2:539b93e77479 "add +x to foo.txt" (tip)
713 721 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
714 722 $ hg diff -c tip
715 723 diff --git a/foo.txt b/foo.txt
716 724 old mode 100644
717 725 new mode 100755
718 726
719 727 Test rebasing a commit with copy information, but no content changes
720 728
721 729 $ cd ..
722 730 $ hg clone -q repo1 merge-and-rename
723 731 $ cd merge-and-rename
724 732 $ cat << EOF >> .hg/hgrc
725 733 > [experimental]
726 734 > evolution.createmarkers=True
727 735 > evolution.allowunstable=True
728 736 > EOF
729 737 $ hg co -q 1
730 738 $ hg mv d e
731 739 $ hg ci -qm 'rename d to e'
732 740 $ hg co -q 3
733 741 $ hg merge -q 4
734 742 $ hg ci -m 'merge'
735 743 $ hg co -q 2
736 744 $ mv d e
737 745 $ hg addremove -qs 0
738 746 $ hg ci -qm 'untracked rename of d to e'
739 747 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
740 748 1 new orphan changesets
741 749 $ hg tglog
742 750 @ 6: 676538af172d 'untracked rename of d to e'
743 751 |
744 752 | * 5: 574d92ad16fc 'merge'
745 753 | |\
746 754 | | x 4: 2c8b5dad7956 'rename d to e'
747 755 | | |
748 756 | o | 3: ca58782ad1e4 'b'
749 757 |/ /
750 758 o / 2: 814f6bd05178 'c'
751 759 |/
752 760 o 1: 02952614a83d 'd'
753 761 |
754 762 o 0: b173517d0057 'a'
755 763
756 764 $ hg rebase -b 5 -d tip
757 765 rebasing 3:ca58782ad1e4 "b"
758 766 rebasing 5:574d92ad16fc "merge"
759 767 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
760 768
761 769 $ cd ..
762 770
763 771 Test rebasing a commit with copy information
764 772
765 773 $ hg init rebase-rename
766 774 $ cd rebase-rename
767 775 $ echo a > a
768 776 $ hg ci -Aqm 'add a'
769 777 $ echo a2 > a
770 778 $ hg ci -m 'modify a'
771 779 $ hg co -q 0
772 780 $ hg mv a b
773 781 $ hg ci -qm 'rename a to b'
774 782 $ hg rebase -d 1
775 783 rebasing 2:b977edf6f839 "rename a to b" (tip)
776 784 merging a and b to b
777 785 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
778 786 $ hg st --copies --change .
779 787 A b
780 788 a
781 789 R a
782 790 $ cd ..
783 791
784 792 Test rebasing a commit with copy information, where the target is empty
785 793
786 794 $ hg init rebase-rename-empty
787 795 $ cd rebase-rename-empty
788 796 $ echo a > a
789 797 $ hg ci -Aqm 'add a'
790 798 $ cat > a
791 799 $ hg ci -m 'make a empty'
792 800 $ hg co -q 0
793 801 $ hg mv a b
794 802 $ hg ci -qm 'rename a to b'
795 803 $ hg rebase -d 1
796 804 rebasing 2:b977edf6f839 "rename a to b" (tip)
797 805 merging a and b to b
798 806 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
799 807 $ hg st --copies --change .
800 808 A b
801 809 a
802 810 R a
803 811 $ cd ..
804 812 Rebase across a copy with --collapse
805 813
806 814 $ hg init rebase-rename-collapse
807 815 $ cd rebase-rename-collapse
808 816 $ echo a > a
809 817 $ hg ci -Aqm 'add a'
810 818 $ hg mv a b
811 819 $ hg ci -m 'rename a to b'
812 820 $ hg co -q 0
813 821 $ echo a2 > a
814 822 $ hg ci -qm 'modify a'
815 823 $ hg rebase -r . -d 1 --collapse
816 824 rebasing 2:41c4ea50d4cf "modify a" (tip)
817 825 merging b and a to b
818 826 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
819 827 $ cd ..
820 828
821 829 Test rebasing when the file we are merging in destination is empty
822 830
823 831 $ hg init test
824 832 $ cd test
825 833 $ echo a > foo
826 834 $ hg ci -Aqm 'added a to foo'
827 835
828 836 $ rm foo
829 837 $ touch foo
830 838 $ hg di
831 839 diff --git a/foo b/foo
832 840 --- a/foo
833 841 +++ b/foo
834 842 @@ -1,1 +0,0 @@
835 843 -a
836 844
837 845 $ hg ci -m "make foo an empty file"
838 846
839 847 $ hg up '.^'
840 848 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
841 849 $ echo b > foo
842 850 $ hg di
843 851 diff --git a/foo b/foo
844 852 --- a/foo
845 853 +++ b/foo
846 854 @@ -1,1 +1,1 @@
847 855 -a
848 856 +b
849 857 $ hg ci -m "add b to foo"
850 858 created new head
851 859
852 860 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
853 861 rebasing 2:fb62b706688e "add b to foo" (tip)
854 862 merging foo
855 863 hit merge conflicts; rebasing that commit again in the working copy
856 864 merging foo
857 865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
858 866 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
859 867 [1]
860 868
861 869 $ cd $TESTTMP
862 870
863 871 Test rebasing when we're in the middle of a rebase already
864 872 $ hg init test_issue6214
865 873 $ cd test_issue6214
866 874 $ echo r0 > r0
867 875 $ hg ci -qAm 'r0'
868 876 $ echo hi > foo
869 877 $ hg ci -qAm 'hi from foo'
870 878 $ hg co -q '.^'
871 879 $ echo bye > foo
872 880 $ hg ci -qAm 'bye from foo'
873 881 $ hg co -q '.^'
874 882 $ echo unrelated > some_other_file
875 883 $ hg ci -qAm 'some unrelated changes'
876 884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
877 885 @ 3: some unrelated changes
878 886 | some_other_file
879 887 | o 2: bye from foo
880 888 |/ foo
881 889 | o 1: hi from foo
882 890 |/ foo
883 891 o 0: r0
884 892 r0
885 893 $ hg rebase -r 2 -d 1 -t:merge3
886 894 rebasing 2:b4d249fbf8dd "bye from foo"
887 895 merging foo
888 896 hit merge conflicts; rebasing that commit again in the working copy
889 897 merging foo
890 898 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
891 899 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
892 900 [1]
893 901 $ hg rebase -r 3 -d 1 -t:merge3
894 902 abort: rebase in progress
895 903 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
896 904 [255]
897 905 $ hg resolve --list
898 906 U foo
899 907 $ hg resolve --all --re-merge -t:other
900 908 (no more unresolved files)
901 909 continue: hg rebase --continue
902 910 $ hg rebase --continue
903 911 rebasing 2:b4d249fbf8dd "bye from foo"
904 912 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
905 913 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
906 914 o 3: bye from foo
907 915 | foo
908 916 | @ 2: some unrelated changes
909 917 | | some_other_file
910 918 o | 1: hi from foo
911 919 |/ foo
912 920 o 0: r0
913 921 r0
914 922
915 923 $ cd ..
916 924
917 925 Changesets that become empty should not be committed. Merges are not empty by
918 926 definition.
919 927
920 928 $ hg init keep_merge
921 929 $ cd keep_merge
922 930 $ echo base > base; hg add base; hg ci -m base
923 931 $ echo test > test; hg add test; hg ci -m a
924 932 $ hg up 0 -q
925 933 $ echo test > test; hg add test; hg ci -m b -q
926 934 $ hg up 0 -q
927 935 $ echo test > test; hg add test; hg ci -m c -q
928 936 $ hg up 1 -q
929 937 $ hg merge 2 -q
930 938 $ hg ci -m merge
931 939 $ hg up null -q
932 940 $ hg tglog
933 941 o 4: 59c8292117b1 'merge'
934 942 |\
935 943 | | o 3: 531f80391e4a 'c'
936 944 | | |
937 945 | o | 2: 0194f1db184a 'b'
938 946 | |/
939 947 o / 1: 6f252845ea45 'a'
940 948 |/
941 949 o 0: d20a80d4def3 'base'
942 950
943 951 $ hg rebase -s 2 -d 3
944 952 rebasing 2:0194f1db184a "b"
945 953 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
946 954 rebasing 4:59c8292117b1 "merge" (tip)
947 955 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
948 956 $ hg tglog
949 957 o 3: 506e2454484b 'merge'
950 958 |\
951 959 | o 2: 531f80391e4a 'c'
952 960 | |
953 961 o | 1: 6f252845ea45 'a'
954 962 |/
955 963 o 0: d20a80d4def3 'base'
956 964
957 965
958 966 $ cd ..
959 967
960 968 Test (virtual) working directory without changes, created by merge conflict
961 969 resolution. There was a regression where the file was incorrectly detected as
962 970 changed although the file contents were the same as in the parent.
963 971
964 972 $ hg init nofilechanges
965 973 $ cd nofilechanges
966 974 $ echo a > a; hg add a; hg ci -m a
967 975 $ echo foo > test; hg add test; hg ci -m b
968 976 $ hg up 0 -q
969 977 $ echo bar > test; hg add test; hg ci -m c
970 978 created new head
971 979 $ hg rebase -d 2 -d 1 --tool :local
972 980 rebasing 2:ca2749322ee5 "c" (tip)
973 981 note: not rebasing 2:ca2749322ee5 "c" (tip), its destination already has all its changes
974 982 saved backup bundle to $TESTTMP/nofilechanges/.hg/strip-backup/ca2749322ee5-6dc7e94b-rebase.hg
General Comments 0
You need to be logged in to leave comments. Login now