##// END OF EJS Templates
tests: stabilize test-shelve.t#phasebased for #no-symlink and #no-execbit...
Matt Harbison -
r39797:4675c122 default
parent child Browse files
Show More
@@ -1,1866 +1,1884 b''
1 1 #testcases stripbased phasebased
2 2
3 3 $ cat <<EOF >> $HGRCPATH
4 4 > [extensions]
5 5 > mq =
6 6 > shelve =
7 7 > [defaults]
8 8 > diff = --nodates --git
9 9 > qnew = --date '0 0'
10 10 > [shelve]
11 11 > maxbackups = 2
12 12 > EOF
13 13
14 14 #if phasebased
15 15
16 16 $ cat <<EOF >> $HGRCPATH
17 17 > [format]
18 18 > internal-phase = yes
19 19 > EOF
20 20
21 21 #endif
22 22
23 23 $ hg init repo
24 24 $ cd repo
25 25 $ mkdir a b
26 26 $ echo a > a/a
27 27 $ echo b > b/b
28 28 $ echo c > c
29 29 $ echo d > d
30 30 $ echo x > x
31 31 $ hg addremove -q
32 32
33 33 shelve has a help message
34 34 $ hg shelve -h
35 35 hg shelve [OPTION]... [FILE]...
36 36
37 37 save and set aside changes from the working directory
38 38
39 39 Shelving takes files that "hg status" reports as not clean, saves the
40 40 modifications to a bundle (a shelved change), and reverts the files so
41 41 that their state in the working directory becomes clean.
42 42
43 43 To restore these changes to the working directory, using "hg unshelve";
44 44 this will work even if you switch to a different commit.
45 45
46 46 When no files are specified, "hg shelve" saves all not-clean files. If
47 47 specific files or directories are named, only changes to those files are
48 48 shelved.
49 49
50 50 In bare shelve (when no files are specified, without interactive, include
51 51 and exclude option), shelving remembers information if the working
52 52 directory was on newly created branch, in other words working directory
53 53 was on different branch than its first parent. In this situation
54 54 unshelving restores branch information to the working directory.
55 55
56 56 Each shelved change has a name that makes it easier to find later. The
57 57 name of a shelved change defaults to being based on the active bookmark,
58 58 or if there is no active bookmark, the current named branch. To specify a
59 59 different name, use "--name".
60 60
61 61 To see a list of existing shelved changes, use the "--list" option. For
62 62 each shelved change, this will print its name, age, and description; use "
63 63 --patch" or "--stat" for more details.
64 64
65 65 To delete specific shelved changes, use "--delete". To delete all shelved
66 66 changes, use "--cleanup".
67 67
68 68 (use 'hg help -e shelve' to show help for the shelve extension)
69 69
70 70 options ([+] can be repeated):
71 71
72 72 -A --addremove mark new/missing files as added/removed before
73 73 shelving
74 74 -u --unknown store unknown files in the shelve
75 75 --cleanup delete all shelved changes
76 76 --date DATE shelve with the specified commit date
77 77 -d --delete delete the named shelved change(s)
78 78 -e --edit invoke editor on commit messages
79 79 -l --list list current shelves
80 80 -m --message TEXT use text as shelve message
81 81 -n --name NAME use the given name for the shelved commit
82 82 -p --patch output patches for changes (provide the names of the
83 83 shelved changes as positional arguments)
84 84 -i --interactive interactive mode, only works while creating a shelve
85 85 --stat output diffstat-style summary of changes (provide
86 86 the names of the shelved changes as positional
87 87 arguments)
88 88 -I --include PATTERN [+] include names matching the given patterns
89 89 -X --exclude PATTERN [+] exclude names matching the given patterns
90 90 --mq operate on patch repository
91 91
92 92 (some details hidden, use --verbose to show complete help)
93 93
94 94 shelving in an empty repo should be possible
95 95 (this tests also that editor is not invoked, if '--edit' is not
96 96 specified)
97 97
98 98 $ HGEDITOR=cat hg shelve
99 99 shelved as default
100 100 0 files updated, 0 files merged, 5 files removed, 0 files unresolved
101 101
102 102 $ hg unshelve
103 103 unshelving change 'default'
104 104
105 105 $ hg commit -q -m 'initial commit'
106 106
107 107 $ hg shelve
108 108 nothing changed
109 109 [1]
110 110
111 111 make sure shelve files were backed up
112 112
113 113 $ ls .hg/shelve-backup
114 114 default.hg
115 115 default.patch
116 116 default.shelve
117 117
118 118 checks to make sure we dont create a directory or
119 119 hidden file while choosing a new shelve name
120 120
121 121 when we are given a name
122 122
123 123 $ hg shelve -n foo/bar
124 124 abort: shelved change names can not contain slashes
125 125 [255]
126 126 $ hg shelve -n .baz
127 127 abort: shelved change names can not start with '.'
128 128 [255]
129 129 $ hg shelve -n foo\\bar
130 130 abort: shelved change names can not contain slashes
131 131 [255]
132 132
133 133 when shelve has to choose itself
134 134
135 135 $ hg branch x/y -q
136 136 $ hg commit -q -m "Branch commit 0"
137 137 $ hg shelve
138 138 nothing changed
139 139 [1]
140 140 $ hg branch .x -q
141 141 $ hg commit -q -m "Branch commit 1"
142 142 $ hg shelve
143 143 nothing changed
144 144 [1]
145 145 $ hg branch x\\y -q
146 146 $ hg commit -q -m "Branch commit 2"
147 147 $ hg shelve
148 148 nothing changed
149 149 [1]
150 150
151 151 cleaning the branches made for name checking tests
152 152
153 153 $ hg up default -q
154 154 $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
155 155
156 156 create an mq patch - shelving should work fine with a patch applied
157 157
158 158 $ echo n > n
159 159 $ hg add n
160 160 $ hg commit n -m second
161 161 $ hg qnew second.patch
162 162
163 163 shelve a change that we will delete later
164 164
165 165 $ echo a >> a/a
166 166 $ hg shelve
167 167 shelved as default
168 168 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 169
170 170 set up some more complex changes to shelve
171 171
172 172 $ echo a >> a/a
173 173 $ hg mv b b.rename
174 174 moving b/b to b.rename/b
175 175 $ hg cp c c.copy
176 176 $ hg status -C
177 177 M a/a
178 178 A b.rename/b
179 179 b/b
180 180 A c.copy
181 181 c
182 182 R b/b
183 183
184 184 the common case - no options or filenames
185 185
186 186 $ hg shelve
187 187 shelved as default-01
188 188 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
189 189 $ hg status -C
190 190
191 191 ensure that our shelved changes exist
192 192
193 193 $ hg shelve -l
194 194 default-01 (*)* changes to: [mq]: second.patch (glob)
195 195 default (*)* changes to: [mq]: second.patch (glob)
196 196
197 197 $ hg shelve -l -p default
198 198 default (*)* changes to: [mq]: second.patch (glob)
199 199
200 200 diff --git a/a/a b/a/a
201 201 --- a/a/a
202 202 +++ b/a/a
203 203 @@ -1,1 +1,2 @@
204 204 a
205 205 +a
206 206
207 207 $ hg shelve --list --addremove
208 208 abort: options '--list' and '--addremove' may not be used together
209 209 [255]
210 210
211 211 delete our older shelved change
212 212
213 213 $ hg shelve -d default
214 214 $ hg qfinish -a -q
215 215
216 216 ensure shelve backups aren't overwritten
217 217
218 218 $ ls .hg/shelve-backup/
219 219 default-1.hg
220 220 default-1.patch
221 221 default-1.shelve
222 222 default.hg
223 223 default.patch
224 224 default.shelve
225 225
226 226 local edits should not prevent a shelved change from applying
227 227
228 228 $ printf "z\na\n" > a/a
229 229 $ hg unshelve --keep
230 230 unshelving change 'default-01'
231 231 temporarily committing pending changes (restore with 'hg unshelve --abort')
232 232 rebasing shelved changes
233 233 merging a/a
234 234
235 235 $ hg revert --all -q
236 236 $ rm a/a.orig b.rename/b c.copy
237 237
238 238 apply it and make sure our state is as expected
239 239
240 240 (this also tests that same timestamp prevents backups from being
241 241 removed, even though there are more than 'maxbackups' backups)
242 242
243 243 $ f -t .hg/shelve-backup/default.patch
244 244 .hg/shelve-backup/default.patch: file
245 245 $ touch -t 200001010000 .hg/shelve-backup/default.patch
246 246 $ f -t .hg/shelve-backup/default-1.patch
247 247 .hg/shelve-backup/default-1.patch: file
248 248 $ touch -t 200001010000 .hg/shelve-backup/default-1.patch
249 249
250 250 $ hg unshelve
251 251 unshelving change 'default-01'
252 252 $ hg status -C
253 253 M a/a
254 254 A b.rename/b
255 255 b/b
256 256 A c.copy
257 257 c
258 258 R b/b
259 259 $ hg shelve -l
260 260
261 261 (both of default.hg and default-1.hg should be still kept, because it
262 262 is difficult to decide actual order of them from same timestamp)
263 263
264 264 $ ls .hg/shelve-backup/
265 265 default-01.hg
266 266 default-01.patch
267 267 default-01.shelve
268 268 default-1.hg
269 269 default-1.patch
270 270 default-1.shelve
271 271 default.hg
272 272 default.patch
273 273 default.shelve
274 274
275 275 $ hg unshelve
276 276 abort: no shelved changes to apply!
277 277 [255]
278 278 $ hg unshelve foo
279 279 abort: shelved change 'foo' not found
280 280 [255]
281 281
282 282 named shelves, specific filenames, and "commit messages" should all work
283 283 (this tests also that editor is invoked, if '--edit' is specified)
284 284
285 285 $ hg status -C
286 286 M a/a
287 287 A b.rename/b
288 288 b/b
289 289 A c.copy
290 290 c
291 291 R b/b
292 292 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
293 293 wat
294 294
295 295
296 296 HG: Enter commit message. Lines beginning with 'HG:' are removed.
297 297 HG: Leave message empty to abort commit.
298 298 HG: --
299 299 HG: user: shelve@localhost
300 300 HG: branch 'default'
301 301 HG: changed a/a
302 302
303 303 expect "a" to no longer be present, but status otherwise unchanged
304 304
305 305 $ hg status -C
306 306 A b.rename/b
307 307 b/b
308 308 A c.copy
309 309 c
310 310 R b/b
311 311 $ hg shelve -l --stat
312 312 wibble (*) wat (glob)
313 313 a/a | 1 +
314 314 1 files changed, 1 insertions(+), 0 deletions(-)
315 315
316 316 and now "a/a" should reappear
317 317
318 318 $ cd a
319 319 $ hg unshelve -q wibble
320 320 $ cd ..
321 321 $ hg status -C
322 322 M a/a
323 323 A b.rename/b
324 324 b/b
325 325 A c.copy
326 326 c
327 327 R b/b
328 328
329 329 ensure old shelve backups are being deleted automatically
330 330
331 331 $ ls .hg/shelve-backup/
332 332 default-01.hg
333 333 default-01.patch
334 334 default-01.shelve
335 335 wibble.hg
336 336 wibble.patch
337 337 wibble.shelve
338 338
339 339 cause unshelving to result in a merge with 'a' conflicting
340 340
341 341 $ hg shelve -q
342 342 $ echo c>>a/a
343 343 $ hg commit -m second
344 344 $ hg tip --template '{files}\n'
345 345 a/a
346 346
347 347 add an unrelated change that should be preserved
348 348
349 349 $ mkdir foo
350 350 $ echo foo > foo/foo
351 351 $ hg add foo/foo
352 352
353 353 force a conflicted merge to occur
354 354
355 355 $ hg unshelve
356 356 unshelving change 'default'
357 357 temporarily committing pending changes (restore with 'hg unshelve --abort')
358 358 rebasing shelved changes
359 359 merging a/a
360 360 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
361 361 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
362 362 [1]
363 363 $ hg status -v
364 364 M a/a
365 365 M b.rename/b
366 366 M c.copy
367 367 R b/b
368 368 ? a/a.orig
369 369 # The repository is in an unfinished *unshelve* state.
370 370
371 371 # Unresolved merge conflicts:
372 372 #
373 373 # a/a
374 374 #
375 375 # To mark files as resolved: hg resolve --mark FILE
376 376
377 377 # To continue: hg unshelve --continue
378 378 # To abort: hg unshelve --abort
379 379
380 380
381 381 ensure that we have a merge with unresolved conflicts
382 382
383 383 #if phasebased
384 384 $ hg heads -q --template '{rev}\n'
385 385 8
386 386 5
387 387 $ hg parents -q --template '{rev}\n'
388 388 8
389 389 5
390 390 #endif
391 391
392 392 #if stripbased
393 393 $ hg heads -q --template '{rev}\n'
394 394 5
395 395 4
396 396 $ hg parents -q --template '{rev}\n'
397 397 4
398 398 5
399 399 #endif
400 400
401 401 $ hg status
402 402 M a/a
403 403 M b.rename/b
404 404 M c.copy
405 405 R b/b
406 406 ? a/a.orig
407 407 $ hg diff
408 408 diff --git a/a/a b/a/a
409 409 --- a/a/a
410 410 +++ b/a/a
411 411 @@ -1,2 +1,6 @@
412 412 a
413 413 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
414 414 c
415 415 +=======
416 416 +a
417 417 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch
418 418 diff --git a/b/b b/b.rename/b
419 419 rename from b/b
420 420 rename to b.rename/b
421 421 diff --git a/c b/c.copy
422 422 copy from c
423 423 copy to c.copy
424 424 $ hg resolve -l
425 425 U a/a
426 426
427 427 $ hg shelve
428 428 abort: unshelve already in progress
429 429 (use 'hg unshelve --continue' or 'hg unshelve --abort')
430 430 [255]
431 431
432 432 abort the unshelve and be happy
433 433
434 434 $ hg status
435 435 M a/a
436 436 M b.rename/b
437 437 M c.copy
438 438 R b/b
439 439 ? a/a.orig
440 440 $ hg unshelve -a
441 441 unshelve of 'default' aborted
442 442 $ hg heads -q
443 443 [37]:2e69b451d1ea (re)
444 444 $ hg parents
445 445 changeset: [37]:2e69b451d1ea (re)
446 446 tag: tip
447 447 parent: 3:509104101065 (?)
448 448 user: test
449 449 date: Thu Jan 01 00:00:00 1970 +0000
450 450 summary: second
451 451
452 452 $ hg resolve -l
453 453 $ hg status
454 454 A foo/foo
455 455 ? a/a.orig
456 456
457 457 try to continue with no unshelve underway
458 458
459 459 $ hg unshelve -c
460 460 abort: no unshelve in progress
461 461 [255]
462 462 $ hg status
463 463 A foo/foo
464 464 ? a/a.orig
465 465
466 466 redo the unshelve to get a conflict
467 467
468 468 $ hg unshelve -q
469 469 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
470 470 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
471 471 [1]
472 472
473 473 attempt to continue
474 474
475 475 $ hg unshelve -c
476 476 abort: unresolved conflicts, can't continue
477 477 (see 'hg resolve', then 'hg unshelve --continue')
478 478 [255]
479 479
480 480 $ hg revert -r . a/a
481 481 $ hg resolve -m a/a
482 482 (no more unresolved files)
483 483 continue: hg unshelve --continue
484 484
485 485 $ hg commit -m 'commit while unshelve in progress'
486 486 abort: unshelve already in progress
487 487 (use 'hg unshelve --continue' or 'hg unshelve --abort')
488 488 [255]
489 489
490 490 $ hg graft --continue
491 491 abort: no graft in progress
492 492 (continue: hg unshelve --continue)
493 493 [255]
494 494 $ hg unshelve -c
495 495 unshelve of 'default' complete
496 496
497 497 ensure the repo is as we hope
498 498
499 499 $ hg parents
500 500 changeset: [37]:2e69b451d1ea (re)
501 501 tag: tip
502 502 parent: 3:509104101065 (?)
503 503 user: test
504 504 date: Thu Jan 01 00:00:00 1970 +0000
505 505 summary: second
506 506
507 507 $ hg heads -q
508 508 [37]:2e69b451d1ea (re)
509 509
510 510 $ hg status -C
511 511 A b.rename/b
512 512 b/b
513 513 A c.copy
514 514 c
515 515 A foo/foo
516 516 R b/b
517 517 ? a/a.orig
518 518
519 519 there should be no shelves left
520 520
521 521 $ hg shelve -l
522 522
523 523 #if execbit
524 524
525 525 ensure that metadata-only changes are shelved
526 526
527 527 $ chmod +x a/a
528 528 $ hg shelve -q -n execbit a/a
529 529 $ hg status a/a
530 530 $ hg unshelve -q execbit
531 531 $ hg status a/a
532 532 M a/a
533 533 $ hg revert a/a
534 534
535 #else
536
537 Dummy shelve op, to keep rev numbers aligned
538
539 $ echo foo > a/a
540 $ hg shelve -q -n dummy a/a
541 $ hg unshelve -q dummy
542 $ hg revert a/a
543
535 544 #endif
536 545
537 546 #if symlink
538 547
539 548 $ rm a/a
540 549 $ ln -s foo a/a
541 550 $ hg shelve -q -n symlink a/a
542 551 $ hg status a/a
543 552 $ hg unshelve -q -n symlink
544 553 $ hg status a/a
545 554 M a/a
546 555 $ hg revert a/a
547 556
557 #else
558
559 Dummy shelve op, to keep rev numbers aligned
560
561 $ echo bar > a/a
562 $ hg shelve -q -n dummy a/a
563 $ hg unshelve -q dummy
564 $ hg revert a/a
565
548 566 #endif
549 567
550 568 set up another conflict between a commit and a shelved change
551 569
552 570 $ hg revert -q -C -a
553 571 $ rm a/a.orig b.rename/b c.copy
554 572 $ echo a >> a/a
555 573 $ hg shelve -q
556 574 $ echo x >> a/a
557 575 $ hg ci -m 'create conflict'
558 576 $ hg add foo/foo
559 577
560 578 if we resolve a conflict while unshelving, the unshelve should succeed
561 579
562 580 $ hg unshelve --tool :merge-other --keep
563 581 unshelving change 'default'
564 582 temporarily committing pending changes (restore with 'hg unshelve --abort')
565 583 rebasing shelved changes
566 584 merging a/a
567 585 $ hg parents -q
568 586 (4|13):33f7f61e6c5e (re)
569 587 $ hg shelve -l
570 588 default (*)* changes to: second (glob)
571 589 $ hg status
572 590 M a/a
573 591 A foo/foo
574 592 $ cat a/a
575 593 a
576 594 c
577 595 a
578 596 $ cat > a/a << EOF
579 597 > a
580 598 > c
581 599 > x
582 600 > EOF
583 601
584 602 $ HGMERGE=true hg unshelve
585 603 unshelving change 'default'
586 604 temporarily committing pending changes (restore with 'hg unshelve --abort')
587 605 rebasing shelved changes
588 606 merging a/a
589 607 note: unshelved changes already existed in the working copy
590 608 $ hg parents -q
591 609 (4|13):33f7f61e6c5e (re)
592 610 $ hg shelve -l
593 611 $ hg status
594 612 A foo/foo
595 613 $ cat a/a
596 614 a
597 615 c
598 616 x
599 617
600 618 test keep and cleanup
601 619
602 620 $ hg shelve
603 621 shelved as default
604 622 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
605 623 $ hg shelve --list
606 624 default (*)* changes to: create conflict (glob)
607 625 $ hg unshelve -k
608 626 unshelving change 'default'
609 627 $ hg shelve --list
610 628 default (*)* changes to: create conflict (glob)
611 629 $ hg shelve --cleanup
612 630 $ hg shelve --list
613 631
614 632 $ hg shelve --cleanup --delete
615 633 abort: options '--cleanup' and '--delete' may not be used together
616 634 [255]
617 635 $ hg shelve --cleanup --patch
618 636 abort: options '--cleanup' and '--patch' may not be used together
619 637 [255]
620 638 $ hg shelve --cleanup --message MESSAGE
621 639 abort: options '--cleanup' and '--message' may not be used together
622 640 [255]
623 641
624 642 test bookmarks
625 643
626 644 $ hg bookmark test
627 645 $ hg bookmark
628 646 \* test (4|13):33f7f61e6c5e (re)
629 647 $ hg shelve
630 648 shelved as test
631 649 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
632 650 $ hg bookmark
633 651 \* test (4|13):33f7f61e6c5e (re)
634 652 $ hg unshelve
635 653 unshelving change 'test'
636 654 $ hg bookmark
637 655 \* test (4|13):33f7f61e6c5e (re)
638 656
639 657 shelve should still work even if mq is disabled
640 658
641 659 $ hg --config extensions.mq=! shelve
642 660 shelved as test
643 661 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
644 662 $ hg --config extensions.mq=! shelve --list
645 663 test (*)* changes to: create conflict (glob)
646 664 $ hg bookmark
647 665 \* test (4|13):33f7f61e6c5e (re)
648 666 $ hg --config extensions.mq=! unshelve
649 667 unshelving change 'test'
650 668 $ hg bookmark
651 669 \* test (4|13):33f7f61e6c5e (re)
652 670
653 671 shelve should leave dirstate clean (issue4055)
654 672
655 673 $ cd ..
656 674 $ hg init shelverebase
657 675 $ cd shelverebase
658 676 $ printf 'x\ny\n' > x
659 677 $ echo z > z
660 678 $ hg commit -Aqm xy
661 679 $ echo z >> x
662 680 $ hg commit -Aqm z
663 681 $ hg up 5c4c67fb7dce
664 682 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 683 $ printf 'a\nx\ny\nz\n' > x
666 684 $ hg commit -Aqm xyz
667 685 $ echo c >> z
668 686 $ hg shelve
669 687 shelved as default
670 688 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
671 689
672 690 $ hg rebase -d 6c103be8f4e4 --config extensions.rebase=
673 691 rebasing 2:323bfa07f744 "xyz"( \(tip\))? (re)
674 692 merging x
675 693 saved backup bundle to \$TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-(78114325|7ae538ef)-rebase.hg (re)
676 694 $ hg unshelve
677 695 unshelving change 'default'
678 696 rebasing shelved changes
679 697 $ hg status
680 698 M z
681 699
682 700 $ cd ..
683 701
684 702 shelve should only unshelve pending changes (issue4068)
685 703
686 704 $ hg init onlypendingchanges
687 705 $ cd onlypendingchanges
688 706 $ touch a
689 707 $ hg ci -Aqm a
690 708 $ touch b
691 709 $ hg ci -Aqm b
692 710 $ hg up -q 3903775176ed
693 711 $ touch c
694 712 $ hg ci -Aqm c
695 713
696 714 $ touch d
697 715 $ hg add d
698 716 $ hg shelve
699 717 shelved as default
700 718 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
701 719 $ hg up -q 0e067c57feba
702 720 $ hg unshelve
703 721 unshelving change 'default'
704 722 rebasing shelved changes
705 723 $ hg status
706 724 A d
707 725
708 726 unshelve should work on an ancestor of the original commit
709 727
710 728 $ hg shelve
711 729 shelved as default
712 730 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
713 731 $ hg up 3903775176ed
714 732 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
715 733 $ hg unshelve
716 734 unshelving change 'default'
717 735 rebasing shelved changes
718 736 $ hg status
719 737 A d
720 738
721 739 test bug 4073 we need to enable obsolete markers for it
722 740
723 741 $ cat >> $HGRCPATH << EOF
724 742 > [experimental]
725 743 > evolution.createmarkers=True
726 744 > EOF
727 745 $ hg shelve
728 746 shelved as default
729 747 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
730 748 $ hg debugobsolete `hg log -r 0e067c57feba -T '{node}'`
731 749 obsoleted 1 changesets
732 750 $ hg unshelve
733 751 unshelving change 'default'
734 752
735 753 unshelve should leave unknown files alone (issue4113)
736 754
737 755 $ echo e > e
738 756 $ hg shelve
739 757 shelved as default
740 758 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
741 759 $ hg status
742 760 ? e
743 761 $ hg unshelve
744 762 unshelving change 'default'
745 763 $ hg status
746 764 A d
747 765 ? e
748 766 $ cat e
749 767 e
750 768
751 769 unshelve should keep a copy of unknown files
752 770
753 771 $ hg add e
754 772 $ hg shelve
755 773 shelved as default
756 774 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
757 775 $ echo z > e
758 776 $ hg unshelve
759 777 unshelving change 'default'
760 778 $ cat e
761 779 e
762 780 $ cat e.orig
763 781 z
764 782
765 783
766 784 unshelve and conflicts with tracked and untracked files
767 785
768 786 preparing:
769 787
770 788 $ rm *.orig
771 789 $ hg ci -qm 'commit stuff'
772 790 $ hg phase -p null:
773 791
774 792 no other changes - no merge:
775 793
776 794 $ echo f > f
777 795 $ hg add f
778 796 $ hg shelve
779 797 shelved as default
780 798 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
781 799 $ echo g > f
782 800 $ hg unshelve
783 801 unshelving change 'default'
784 802 $ hg st
785 803 A f
786 804 ? f.orig
787 805 $ cat f
788 806 f
789 807 $ cat f.orig
790 808 g
791 809
792 810 other uncommitted changes - merge:
793 811
794 812 $ hg st
795 813 A f
796 814 ? f.orig
797 815 $ hg shelve
798 816 shelved as default
799 817 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
800 818 #if repobundlerepo
801 819 $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' --hidden
802 820 o [48] changes to: commit stuff shelve@localhost (re)
803 821 |
804 822 ~
805 823 #endif
806 824 $ hg log -G --template '{rev} {desc|firstline} {author}'
807 825 @ [37] commit stuff test (re)
808 826 |
809 827 | o 2 c test
810 828 |/
811 829 o 0 a test
812 830
813 831 $ mv f.orig f
814 832 $ echo 1 > a
815 833 $ hg unshelve --date '1073741824 0'
816 834 unshelving change 'default'
817 835 temporarily committing pending changes (restore with 'hg unshelve --abort')
818 836 rebasing shelved changes
819 837 merging f
820 838 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
821 839 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
822 840 [1]
823 841
824 842 #if phasebased
825 843 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
826 844 @ 9 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
827 845 |
828 846 | @ 8 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
829 847 |/
830 848 o 7 commit stuff test 1970-01-01 00:00 +0000
831 849 |
832 850 | o 2 c test 1970-01-01 00:00 +0000
833 851 |/
834 852 o 0 a test 1970-01-01 00:00 +0000
835 853
836 854 #endif
837 855
838 856 #if stripbased
839 857 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}'
840 858 @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000
841 859 |
842 860 | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000
843 861 |/
844 862 o 3 commit stuff test 1970-01-01 00:00 +0000
845 863 |
846 864 | o 2 c test 1970-01-01 00:00 +0000
847 865 |/
848 866 o 0 a test 1970-01-01 00:00 +0000
849 867
850 868 #endif
851 869
852 870 $ hg st
853 871 M f
854 872 ? f.orig
855 873 $ cat f
856 874 <<<<<<< shelve: d44eae5c3d33 - shelve: pending changes temporary commit
857 875 g
858 876 =======
859 877 f
860 878 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
861 879 $ cat f.orig
862 880 g
863 881 $ hg unshelve --abort -t false
864 882 tool option will be ignored
865 883 unshelve of 'default' aborted
866 884 $ hg st
867 885 M a
868 886 ? f.orig
869 887 $ cat f.orig
870 888 g
871 889 $ hg unshelve
872 890 unshelving change 'default'
873 891 temporarily committing pending changes (restore with 'hg unshelve --abort')
874 892 rebasing shelved changes
875 893 $ hg st
876 894 M a
877 895 A f
878 896 ? f.orig
879 897
880 898 other committed changes - merge:
881 899
882 900 $ hg shelve f
883 901 shelved as default
884 902 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
885 903 $ hg ci a -m 'intermediate other change'
886 904 $ mv f.orig f
887 905 $ hg unshelve
888 906 unshelving change 'default'
889 907 rebasing shelved changes
890 908 merging f
891 909 warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
892 910 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
893 911 [1]
894 912 $ hg st
895 913 M f
896 914 ? f.orig
897 915 $ cat f
898 916 <<<<<<< shelve: 6b563750f973 - test: intermediate other change
899 917 g
900 918 =======
901 919 f
902 920 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff
903 921 $ cat f.orig
904 922 g
905 923 $ hg unshelve --abort
906 924 unshelve of 'default' aborted
907 925 $ hg st
908 926 ? f.orig
909 927 $ cat f.orig
910 928 g
911 929 $ hg shelve --delete default
912 930
913 931 Recreate some conflict again
914 932
915 933 $ cd ../repo
916 934 $ hg up -C -r 2e69b451d1ea
917 935 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
918 936 (leaving bookmark test)
919 937 $ echo y >> a/a
920 938 $ hg shelve
921 939 shelved as default
922 940 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
923 941 $ hg up test
924 942 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
925 943 (activating bookmark test)
926 944 $ hg bookmark
927 945 \* test (4|13):33f7f61e6c5e (re)
928 946 $ hg unshelve
929 947 unshelving change 'default'
930 948 rebasing shelved changes
931 949 merging a/a
932 950 warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark')
933 951 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
934 952 [1]
935 953 $ hg bookmark
936 954 test (4|13):33f7f61e6c5e (re)
937 955
938 956 Test that resolving all conflicts in one direction (so that the rebase
939 957 is a no-op), works (issue4398)
940 958
941 959 $ hg revert -a -r .
942 960 reverting a/a
943 961 $ hg resolve -m a/a
944 962 (no more unresolved files)
945 963 continue: hg unshelve --continue
946 964 $ hg unshelve -c
947 965 note: unshelved changes already existed in the working copy
948 966 unshelve of 'default' complete
949 967 $ hg bookmark
950 968 \* test (4|13):33f7f61e6c5e (re)
951 969 $ hg diff
952 970 $ hg status
953 971 ? a/a.orig
954 972 ? foo/foo
955 973 $ hg summary
956 974 parent: (4|13):33f7f61e6c5e tip (re)
957 975 create conflict
958 976 branch: default
959 977 bookmarks: *test
960 978 commit: 2 unknown (clean)
961 979 update: (current)
962 980 phases: 5 draft
963 981
964 982 $ hg shelve --delete --stat
965 983 abort: options '--delete' and '--stat' may not be used together
966 984 [255]
967 985 $ hg shelve --delete --name NAME
968 986 abort: options '--delete' and '--name' may not be used together
969 987 [255]
970 988
971 989 Test interactive shelve
972 990 $ cat <<EOF >> $HGRCPATH
973 991 > [ui]
974 992 > interactive = true
975 993 > EOF
976 994 $ echo 'a' >> a/b
977 995 $ cat a/a >> a/b
978 996 $ echo 'x' >> a/b
979 997 $ mv a/b a/a
980 998 $ echo 'a' >> foo/foo
981 999 $ hg st
982 1000 M a/a
983 1001 ? a/a.orig
984 1002 ? foo/foo
985 1003 $ cat a/a
986 1004 a
987 1005 a
988 1006 c
989 1007 x
990 1008 x
991 1009 $ cat foo/foo
992 1010 foo
993 1011 a
994 1012 $ hg shelve --interactive --config ui.interactive=false
995 1013 abort: running non-interactively
996 1014 [255]
997 1015 $ hg shelve --interactive << EOF
998 1016 > y
999 1017 > y
1000 1018 > n
1001 1019 > EOF
1002 1020 diff --git a/a/a b/a/a
1003 1021 2 hunks, 2 lines changed
1004 1022 examine changes to 'a/a'? [Ynesfdaq?] y
1005 1023
1006 1024 @@ -1,3 +1,4 @@
1007 1025 +a
1008 1026 a
1009 1027 c
1010 1028 x
1011 1029 record change 1/2 to 'a/a'? [Ynesfdaq?] y
1012 1030
1013 1031 @@ -1,3 +2,4 @@
1014 1032 a
1015 1033 c
1016 1034 x
1017 1035 +x
1018 1036 record change 2/2 to 'a/a'? [Ynesfdaq?] n
1019 1037
1020 1038 shelved as test
1021 1039 merging a/a
1022 1040 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1023 1041 $ cat a/a
1024 1042 a
1025 1043 c
1026 1044 x
1027 1045 x
1028 1046 $ cat foo/foo
1029 1047 foo
1030 1048 a
1031 1049 $ hg st
1032 1050 M a/a
1033 1051 ? foo/foo
1034 1052 $ hg bookmark
1035 1053 \* test (4|13):33f7f61e6c5e (re)
1036 1054 $ hg unshelve
1037 1055 unshelving change 'test'
1038 1056 temporarily committing pending changes (restore with 'hg unshelve --abort')
1039 1057 rebasing shelved changes
1040 1058 merging a/a
1041 1059 $ hg bookmark
1042 1060 \* test (4|13):33f7f61e6c5e (re)
1043 1061 $ cat a/a
1044 1062 a
1045 1063 a
1046 1064 c
1047 1065 x
1048 1066 x
1049 1067
1050 1068 shelve --patch and shelve --stat should work with valid shelfnames
1051 1069
1052 1070 $ hg up --clean .
1053 1071 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1054 1072 (leaving bookmark test)
1055 1073 $ hg shelve --list
1056 1074 $ echo 'patch a' > shelf-patch-a
1057 1075 $ hg add shelf-patch-a
1058 1076 $ hg shelve
1059 1077 shelved as default
1060 1078 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1061 1079 $ echo 'patch b' > shelf-patch-b
1062 1080 $ hg add shelf-patch-b
1063 1081 $ hg shelve
1064 1082 shelved as default-01
1065 1083 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1066 1084 $ hg shelve --patch default default-01
1067 1085 default-01 (*)* changes to: create conflict (glob)
1068 1086
1069 1087 diff --git a/shelf-patch-b b/shelf-patch-b
1070 1088 new file mode 100644
1071 1089 --- /dev/null
1072 1090 +++ b/shelf-patch-b
1073 1091 @@ -0,0 +1,1 @@
1074 1092 +patch b
1075 1093 default (*)* changes to: create conflict (glob)
1076 1094
1077 1095 diff --git a/shelf-patch-a b/shelf-patch-a
1078 1096 new file mode 100644
1079 1097 --- /dev/null
1080 1098 +++ b/shelf-patch-a
1081 1099 @@ -0,0 +1,1 @@
1082 1100 +patch a
1083 1101 $ hg shelve --stat default default-01
1084 1102 default-01 (*)* changes to: create conflict (glob)
1085 1103 shelf-patch-b | 1 +
1086 1104 1 files changed, 1 insertions(+), 0 deletions(-)
1087 1105 default (*)* changes to: create conflict (glob)
1088 1106 shelf-patch-a | 1 +
1089 1107 1 files changed, 1 insertions(+), 0 deletions(-)
1090 1108 $ hg shelve --patch default
1091 1109 default (*)* changes to: create conflict (glob)
1092 1110
1093 1111 diff --git a/shelf-patch-a b/shelf-patch-a
1094 1112 new file mode 100644
1095 1113 --- /dev/null
1096 1114 +++ b/shelf-patch-a
1097 1115 @@ -0,0 +1,1 @@
1098 1116 +patch a
1099 1117 $ hg shelve --stat default
1100 1118 default (*)* changes to: create conflict (glob)
1101 1119 shelf-patch-a | 1 +
1102 1120 1 files changed, 1 insertions(+), 0 deletions(-)
1103 1121 $ hg shelve --patch nonexistentshelf
1104 1122 abort: cannot find shelf nonexistentshelf
1105 1123 [255]
1106 1124 $ hg shelve --stat nonexistentshelf
1107 1125 abort: cannot find shelf nonexistentshelf
1108 1126 [255]
1109 1127 $ hg shelve --patch default nonexistentshelf
1110 1128 abort: cannot find shelf nonexistentshelf
1111 1129 [255]
1112 1130
1113 1131 when the user asks for a patch, we assume they want the most recent shelve if
1114 1132 they don't provide a shelve name
1115 1133
1116 1134 $ hg shelve --patch
1117 1135 default-01 (*)* changes to: create conflict (glob)
1118 1136
1119 1137 diff --git a/shelf-patch-b b/shelf-patch-b
1120 1138 new file mode 100644
1121 1139 --- /dev/null
1122 1140 +++ b/shelf-patch-b
1123 1141 @@ -0,0 +1,1 @@
1124 1142 +patch b
1125 1143
1126 1144 $ cd ..
1127 1145
1128 1146 you shouldn't be able to ask for the patch/stats of the most recent shelve if
1129 1147 there are no shelves
1130 1148
1131 1149 $ hg init noshelves
1132 1150 $ cd noshelves
1133 1151
1134 1152 $ hg shelve --patch
1135 1153 abort: there are no shelves to show
1136 1154 [255]
1137 1155 $ hg shelve --stat
1138 1156 abort: there are no shelves to show
1139 1157 [255]
1140 1158
1141 1159 $ cd ..
1142 1160
1143 1161 Shelve from general delta repo uses bundle2 on disk
1144 1162 --------------------------------------------------
1145 1163
1146 1164 no general delta
1147 1165
1148 1166 $ hg clone --pull repo bundle1 --config format.usegeneraldelta=0
1149 1167 requesting all changes
1150 1168 adding changesets
1151 1169 adding manifests
1152 1170 adding file changes
1153 1171 added 5 changesets with 8 changes to 6 files
1154 1172 new changesets cc01e2b0c59f:33f7f61e6c5e
1155 1173 updating to branch default
1156 1174 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1157 1175 $ cd bundle1
1158 1176 $ echo babar > jungle
1159 1177 $ hg add jungle
1160 1178 $ hg shelve
1161 1179 shelved as default
1162 1180 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1163 1181 $ hg debugbundle .hg/shelved/*.hg
1164 1182 330882a04d2ce8487636b1fb292e5beea77fa1e3
1165 1183 $ cd ..
1166 1184
1167 1185 with general delta
1168 1186
1169 1187 $ hg clone --pull repo bundle2 --config format.usegeneraldelta=1
1170 1188 requesting all changes
1171 1189 adding changesets
1172 1190 adding manifests
1173 1191 adding file changes
1174 1192 added 5 changesets with 8 changes to 6 files
1175 1193 new changesets cc01e2b0c59f:33f7f61e6c5e
1176 1194 updating to branch default
1177 1195 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1178 1196 $ cd bundle2
1179 1197 $ echo babar > jungle
1180 1198 $ hg add jungle
1181 1199 $ hg shelve
1182 1200 shelved as default
1183 1201 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1184 1202 $ hg debugbundle .hg/shelved/*.hg
1185 1203 Stream params: {Compression: BZ}
1186 1204 changegroup -- {nbchanges: 1, version: 02} (mandatory: True)
1187 1205 330882a04d2ce8487636b1fb292e5beea77fa1e3
1188 1206 $ cd ..
1189 1207
1190 1208 Test visibility of in-memory changes inside transaction to external hook
1191 1209 ------------------------------------------------------------------------
1192 1210
1193 1211 $ cd repo
1194 1212
1195 1213 $ echo xxxx >> x
1196 1214 $ hg commit -m "#5: changes to invoke rebase"
1197 1215
1198 1216 $ cat > $TESTTMP/checkvisibility.sh <<EOF
1199 1217 > echo "==== \$1:"
1200 1218 > hg parents --template "VISIBLE {rev}:{node|short}\n"
1201 1219 > # test that pending changes are hidden
1202 1220 > unset HG_PENDING
1203 1221 > hg parents --template "ACTUAL {rev}:{node|short}\n"
1204 1222 > echo "===="
1205 1223 > EOF
1206 1224
1207 1225 $ cat >> .hg/hgrc <<EOF
1208 1226 > [defaults]
1209 1227 > # to fix hash id of temporary revisions
1210 1228 > unshelve = --date '0 0'
1211 1229 > EOF
1212 1230
1213 1231 "hg unshelve" at REV5 implies steps below:
1214 1232
1215 1233 (1) commit changes in the working directory (REV6)
1216 1234 (2) unbundle shelved revision (REV7)
1217 1235 (3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7)
1218 1236 (4) rebase: commit merged revision (REV8)
1219 1237 (5) rebase: update to REV6 (REV8 => REV6)
1220 1238 (6) update to REV5 (REV6 => REV5)
1221 1239 (7) abort transaction
1222 1240
1223 1241 == test visibility to external preupdate hook
1224 1242
1225 1243 $ cat >> .hg/hgrc <<EOF
1226 1244 > [hooks]
1227 1245 > preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate
1228 1246 > EOF
1229 1247
1230 1248 $ echo nnnn >> n
1231 1249
1232 1250 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1233 1251 ==== before-unshelving:
1234 1252 VISIBLE (5|19):703117a2acfb (re)
1235 1253 ACTUAL (5|19):703117a2acfb (re)
1236 1254 ====
1237 1255
1238 1256 $ hg unshelve --keep default
1239 1257 temporarily committing pending changes (restore with 'hg unshelve --abort')
1240 1258 rebasing shelved changes
1241 1259 ==== preupdate:
1242 1260 VISIBLE (6|20):54c00d20fb3f (re)
1243 1261 ACTUAL (5|19):703117a2acfb (re)
1244 1262 ====
1245 1263 ==== preupdate:
1246 1264 VISIBLE (8|21):8efe6f7537dc (re)
1247 1265 ACTUAL (5|19):703117a2acfb (re)
1248 1266 ====
1249 1267 ==== preupdate:
1250 1268 VISIBLE (6|20):54c00d20fb3f (re)
1251 1269 ACTUAL (5|19):703117a2acfb (re)
1252 1270 ====
1253 1271
1254 1272 $ cat >> .hg/hgrc <<EOF
1255 1273 > [hooks]
1256 1274 > preupdate.visibility =
1257 1275 > EOF
1258 1276
1259 1277 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1260 1278 ==== after-unshelving:
1261 1279 VISIBLE (5|19):703117a2acfb (re)
1262 1280 ACTUAL (5|19):703117a2acfb (re)
1263 1281 ====
1264 1282
1265 1283 == test visibility to external update hook
1266 1284
1267 1285 $ hg update -q -C 703117a2acfb
1268 1286
1269 1287 $ cat >> .hg/hgrc <<EOF
1270 1288 > [hooks]
1271 1289 > update.visibility = sh $TESTTMP/checkvisibility.sh update
1272 1290 > EOF
1273 1291
1274 1292 $ echo nnnn >> n
1275 1293
1276 1294 $ sh $TESTTMP/checkvisibility.sh before-unshelving
1277 1295 ==== before-unshelving:
1278 1296 VISIBLE (5|19):703117a2acfb (re)
1279 1297 ACTUAL (5|19):703117a2acfb (re)
1280 1298 ====
1281 1299
1282 1300 $ hg unshelve --keep default
1283 1301 temporarily committing pending changes (restore with 'hg unshelve --abort')
1284 1302 rebasing shelved changes
1285 1303 ==== update:
1286 1304 VISIBLE (6|20):54c00d20fb3f (re)
1287 1305 VISIBLE 1?7:492ed9d705e5 (re)
1288 1306 ACTUAL (5|19):703117a2acfb (re)
1289 1307 ====
1290 1308 ==== update:
1291 1309 VISIBLE (6|20):54c00d20fb3f (re)
1292 1310 ACTUAL (5|19):703117a2acfb (re)
1293 1311 ====
1294 1312 ==== update:
1295 1313 VISIBLE (5|19):703117a2acfb (re)
1296 1314 ACTUAL (5|19):703117a2acfb (re)
1297 1315 ====
1298 1316
1299 1317 $ cat >> .hg/hgrc <<EOF
1300 1318 > [hooks]
1301 1319 > update.visibility =
1302 1320 > EOF
1303 1321
1304 1322 $ sh $TESTTMP/checkvisibility.sh after-unshelving
1305 1323 ==== after-unshelving:
1306 1324 VISIBLE (5|19):703117a2acfb (re)
1307 1325 ACTUAL (5|19):703117a2acfb (re)
1308 1326 ====
1309 1327
1310 1328 $ cd ..
1311 1329
1312 1330 test .orig files go where the user wants them to
1313 1331 ---------------------------------------------------------------
1314 1332 $ hg init salvage
1315 1333 $ cd salvage
1316 1334 $ echo 'content' > root
1317 1335 $ hg commit -A -m 'root' -q
1318 1336 $ echo '' > root
1319 1337 $ hg shelve -q
1320 1338 $ echo 'contADDent' > root
1321 1339 $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups'
1322 1340 warning: conflicts while merging root! (edit, then use 'hg resolve --mark')
1323 1341 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1324 1342 [1]
1325 1343 $ ls .hg/origbackups
1326 1344 root
1327 1345 $ rm -rf .hg/origbackups
1328 1346
1329 1347 test Abort unshelve always gets user out of the unshelved state
1330 1348 ---------------------------------------------------------------
1331 1349
1332 1350 with a corrupted shelve state file
1333 1351 $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate
1334 1352 $ mv ../corrupt-shelvedstate .hg/shelvestate
1335 1353 $ hg unshelve --abort 2>&1 | grep 'aborted'
1336 1354 unshelve of 'default' aborted
1337 1355 $ hg summary
1338 1356 parent: 0:ae8c668541e8 tip
1339 1357 root
1340 1358 branch: default
1341 1359 commit: 1 modified
1342 1360 update: (current)
1343 1361 phases: 1 draft
1344 1362 $ hg up -C .
1345 1363 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1346 1364
1347 1365 $ cd ..
1348 1366
1349 1367 Keep active bookmark while (un)shelving even on shared repo (issue4940)
1350 1368 -----------------------------------------------------------------------
1351 1369
1352 1370 $ cat <<EOF >> $HGRCPATH
1353 1371 > [extensions]
1354 1372 > share =
1355 1373 > EOF
1356 1374
1357 1375 $ hg bookmarks -R repo
1358 1376 test (4|13):33f7f61e6c5e (re)
1359 1377 $ hg share -B repo share
1360 1378 updating working directory
1361 1379 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
1362 1380 $ cd share
1363 1381
1364 1382 $ hg bookmarks
1365 1383 test (4|13):33f7f61e6c5e (re)
1366 1384 $ hg bookmarks foo
1367 1385 $ hg bookmarks
1368 1386 \* foo (5|19):703117a2acfb (re)
1369 1387 test (4|13):33f7f61e6c5e (re)
1370 1388 $ echo x >> x
1371 1389 $ hg shelve
1372 1390 shelved as foo
1373 1391 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1374 1392 $ hg bookmarks
1375 1393 \* foo (5|19):703117a2acfb (re)
1376 1394 test (4|13):33f7f61e6c5e (re)
1377 1395
1378 1396 $ hg unshelve
1379 1397 unshelving change 'foo'
1380 1398 $ hg bookmarks
1381 1399 \* foo (5|19):703117a2acfb (re)
1382 1400 test (4|13):33f7f61e6c5e (re)
1383 1401
1384 1402 $ cd ..
1385 1403
1386 1404 Shelve and unshelve unknown files. For the purposes of unshelve, a shelved
1387 1405 unknown file is the same as a shelved added file, except that it will be in
1388 1406 unknown state after unshelve if and only if it was either absent or unknown
1389 1407 before the unshelve operation.
1390 1408
1391 1409 $ hg init unknowns
1392 1410 $ cd unknowns
1393 1411
1394 1412 The simplest case is if I simply have an unknown file that I shelve and unshelve
1395 1413
1396 1414 $ echo unknown > unknown
1397 1415 $ hg status
1398 1416 ? unknown
1399 1417 $ hg shelve --unknown
1400 1418 shelved as default
1401 1419 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1402 1420 $ hg status
1403 1421 $ hg unshelve
1404 1422 unshelving change 'default'
1405 1423 $ hg status
1406 1424 ? unknown
1407 1425 $ rm unknown
1408 1426
1409 1427 If I shelve, add the file, and unshelve, does it stay added?
1410 1428
1411 1429 $ echo unknown > unknown
1412 1430 $ hg shelve -u
1413 1431 shelved as default
1414 1432 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1415 1433 $ hg status
1416 1434 $ touch unknown
1417 1435 $ hg add unknown
1418 1436 $ hg status
1419 1437 A unknown
1420 1438 $ hg unshelve
1421 1439 unshelving change 'default'
1422 1440 temporarily committing pending changes (restore with 'hg unshelve --abort')
1423 1441 rebasing shelved changes
1424 1442 merging unknown
1425 1443 $ hg status
1426 1444 A unknown
1427 1445 $ hg forget unknown
1428 1446 $ rm unknown
1429 1447
1430 1448 And if I shelve, commit, then unshelve, does it become modified?
1431 1449
1432 1450 $ echo unknown > unknown
1433 1451 $ hg shelve -u
1434 1452 shelved as default
1435 1453 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1436 1454 $ hg status
1437 1455 $ touch unknown
1438 1456 $ hg add unknown
1439 1457 $ hg commit -qm "Add unknown"
1440 1458 $ hg status
1441 1459 $ hg unshelve
1442 1460 unshelving change 'default'
1443 1461 rebasing shelved changes
1444 1462 merging unknown
1445 1463 $ hg status
1446 1464 M unknown
1447 1465 $ hg remove --force unknown
1448 1466 $ hg commit -qm "Remove unknown"
1449 1467
1450 1468 $ cd ..
1451 1469
1452 1470 We expects that non-bare shelve keeps newly created branch in
1453 1471 working directory.
1454 1472
1455 1473 $ hg init shelve-preserve-new-branch
1456 1474 $ cd shelve-preserve-new-branch
1457 1475 $ echo "a" >> a
1458 1476 $ hg add a
1459 1477 $ echo "b" >> b
1460 1478 $ hg add b
1461 1479 $ hg commit -m "ab"
1462 1480 $ echo "aa" >> a
1463 1481 $ echo "bb" >> b
1464 1482 $ hg branch new-branch
1465 1483 marked working directory as branch new-branch
1466 1484 (branches are permanent and global, did you want a bookmark?)
1467 1485 $ hg status
1468 1486 M a
1469 1487 M b
1470 1488 $ hg branch
1471 1489 new-branch
1472 1490 $ hg shelve a
1473 1491 shelved as default
1474 1492 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1475 1493 $ hg branch
1476 1494 new-branch
1477 1495 $ hg status
1478 1496 M b
1479 1497 $ touch "c" >> c
1480 1498 $ hg add c
1481 1499 $ hg status
1482 1500 M b
1483 1501 A c
1484 1502 $ hg shelve --exclude c
1485 1503 shelved as default-01
1486 1504 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1487 1505 $ hg branch
1488 1506 new-branch
1489 1507 $ hg status
1490 1508 A c
1491 1509 $ hg shelve --include c
1492 1510 shelved as default-02
1493 1511 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1494 1512 $ hg branch
1495 1513 new-branch
1496 1514 $ hg status
1497 1515 $ echo "d" >> d
1498 1516 $ hg add d
1499 1517 $ hg status
1500 1518 A d
1501 1519
1502 1520 We expect that bare-shelve will not keep branch in current working directory.
1503 1521
1504 1522 $ hg shelve
1505 1523 shelved as default-03
1506 1524 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1507 1525 $ hg branch
1508 1526 default
1509 1527 $ cd ..
1510 1528
1511 1529 When i shelve commit on newly created branch i expect
1512 1530 that after unshelve newly created branch will be preserved.
1513 1531
1514 1532 $ hg init shelve_on_new_branch_simple
1515 1533 $ cd shelve_on_new_branch_simple
1516 1534 $ echo "aaa" >> a
1517 1535 $ hg commit -A -m "a"
1518 1536 adding a
1519 1537 $ hg branch
1520 1538 default
1521 1539 $ hg branch test
1522 1540 marked working directory as branch test
1523 1541 (branches are permanent and global, did you want a bookmark?)
1524 1542 $ echo "bbb" >> a
1525 1543 $ hg status
1526 1544 M a
1527 1545 $ hg shelve
1528 1546 shelved as default
1529 1547 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1530 1548 $ hg branch
1531 1549 default
1532 1550 $ echo "bbb" >> b
1533 1551 $ hg status
1534 1552 ? b
1535 1553 $ hg unshelve
1536 1554 unshelving change 'default'
1537 1555 marked working directory as branch test
1538 1556 $ hg status
1539 1557 M a
1540 1558 ? b
1541 1559 $ hg branch
1542 1560 test
1543 1561 $ cd ..
1544 1562
1545 1563 When i shelve commit on newly created branch, make
1546 1564 some changes, unshelve it and running into merge
1547 1565 conflicts i expect that after fixing them and
1548 1566 running unshelve --continue newly created branch
1549 1567 will be preserved.
1550 1568
1551 1569 $ hg init shelve_on_new_branch_conflict
1552 1570 $ cd shelve_on_new_branch_conflict
1553 1571 $ echo "aaa" >> a
1554 1572 $ hg commit -A -m "a"
1555 1573 adding a
1556 1574 $ hg branch
1557 1575 default
1558 1576 $ hg branch test
1559 1577 marked working directory as branch test
1560 1578 (branches are permanent and global, did you want a bookmark?)
1561 1579 $ echo "bbb" >> a
1562 1580 $ hg status
1563 1581 M a
1564 1582 $ hg shelve
1565 1583 shelved as default
1566 1584 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1567 1585 $ hg branch
1568 1586 default
1569 1587 $ echo "ccc" >> a
1570 1588 $ hg status
1571 1589 M a
1572 1590 $ hg unshelve
1573 1591 unshelving change 'default'
1574 1592 temporarily committing pending changes (restore with 'hg unshelve --abort')
1575 1593 rebasing shelved changes
1576 1594 merging a
1577 1595 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1578 1596 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1579 1597 [1]
1580 1598 $ echo "aaabbbccc" > a
1581 1599 $ rm a.orig
1582 1600 $ hg resolve --mark a
1583 1601 (no more unresolved files)
1584 1602 continue: hg unshelve --continue
1585 1603 $ hg unshelve --continue
1586 1604 marked working directory as branch test
1587 1605 unshelve of 'default' complete
1588 1606 $ cat a
1589 1607 aaabbbccc
1590 1608 $ hg status
1591 1609 M a
1592 1610 $ hg branch
1593 1611 test
1594 1612 $ hg commit -m "test-commit"
1595 1613
1596 1614 When i shelve on test branch, update to default branch
1597 1615 and unshelve i expect that it will not preserve previous
1598 1616 test branch.
1599 1617
1600 1618 $ echo "xxx" > b
1601 1619 $ hg add b
1602 1620 $ hg shelve
1603 1621 shelved as test
1604 1622 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1605 1623 $ hg update -r 7049e48789d7
1606 1624 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1607 1625 $ hg unshelve
1608 1626 unshelving change 'test'
1609 1627 rebasing shelved changes
1610 1628 $ hg status
1611 1629 A b
1612 1630 $ hg branch
1613 1631 default
1614 1632 $ cd ..
1615 1633
1616 1634 When i unshelve resulting in merge conflicts and makes saved
1617 1635 file shelvedstate looks like in previous versions in
1618 1636 mercurial(without restore branch information in 7th line) i
1619 1637 expect that after resolving conflicts and successfully
1620 1638 running 'shelve --continue' the branch information won't be
1621 1639 restored and branch will be unchanged.
1622 1640
1623 1641 shelve on new branch, conflict with previous shelvedstate
1624 1642
1625 1643 $ hg init conflict
1626 1644 $ cd conflict
1627 1645 $ echo "aaa" >> a
1628 1646 $ hg commit -A -m "a"
1629 1647 adding a
1630 1648 $ hg branch
1631 1649 default
1632 1650 $ hg branch test
1633 1651 marked working directory as branch test
1634 1652 (branches are permanent and global, did you want a bookmark?)
1635 1653 $ echo "bbb" >> a
1636 1654 $ hg status
1637 1655 M a
1638 1656 $ hg shelve
1639 1657 shelved as default
1640 1658 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1641 1659 $ hg branch
1642 1660 default
1643 1661 $ echo "ccc" >> a
1644 1662 $ hg status
1645 1663 M a
1646 1664 $ hg unshelve
1647 1665 unshelving change 'default'
1648 1666 temporarily committing pending changes (restore with 'hg unshelve --abort')
1649 1667 rebasing shelved changes
1650 1668 merging a
1651 1669 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1652 1670 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1653 1671 [1]
1654 1672
1655 1673 Removing restore branch information from shelvedstate file(making it looks like
1656 1674 in previous versions) and running unshelve --continue
1657 1675
1658 1676 $ cp .hg/shelvedstate .hg/shelvedstate_old
1659 1677 $ cat .hg/shelvedstate_old | grep -v 'branchtorestore' > .hg/shelvedstate
1660 1678
1661 1679 $ echo "aaabbbccc" > a
1662 1680 $ rm a.orig
1663 1681 $ hg resolve --mark a
1664 1682 (no more unresolved files)
1665 1683 continue: hg unshelve --continue
1666 1684 $ hg unshelve --continue
1667 1685 unshelve of 'default' complete
1668 1686 $ cat a
1669 1687 aaabbbccc
1670 1688 $ hg status
1671 1689 M a
1672 1690 $ hg branch
1673 1691 default
1674 1692 $ cd ..
1675 1693
1676 1694 On non bare shelve the branch information shouldn't be restored
1677 1695
1678 1696 $ hg init bare_shelve_on_new_branch
1679 1697 $ cd bare_shelve_on_new_branch
1680 1698 $ echo "aaa" >> a
1681 1699 $ hg commit -A -m "a"
1682 1700 adding a
1683 1701 $ hg branch
1684 1702 default
1685 1703 $ hg branch test
1686 1704 marked working directory as branch test
1687 1705 (branches are permanent and global, did you want a bookmark?)
1688 1706 $ echo "bbb" >> a
1689 1707 $ hg status
1690 1708 M a
1691 1709 $ hg shelve a
1692 1710 shelved as default
1693 1711 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1694 1712 $ hg branch
1695 1713 test
1696 1714 $ hg branch default
1697 1715 marked working directory as branch default
1698 1716 (branches are permanent and global, did you want a bookmark?)
1699 1717 $ echo "bbb" >> b
1700 1718 $ hg status
1701 1719 ? b
1702 1720 $ hg unshelve
1703 1721 unshelving change 'default'
1704 1722 $ hg status
1705 1723 M a
1706 1724 ? b
1707 1725 $ hg branch
1708 1726 default
1709 1727 $ cd ..
1710 1728
1711 1729 Prepare unshelve with a corrupted shelvedstate
1712 1730 $ hg init r1 && cd r1
1713 1731 $ echo text1 > file && hg add file
1714 1732 $ hg shelve
1715 1733 shelved as default
1716 1734 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1717 1735 $ echo text2 > file && hg ci -Am text1
1718 1736 adding file
1719 1737 $ hg unshelve
1720 1738 unshelving change 'default'
1721 1739 rebasing shelved changes
1722 1740 merging file
1723 1741 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1724 1742 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1725 1743 [1]
1726 1744 $ echo somethingsomething > .hg/shelvedstate
1727 1745
1728 1746 Unshelve --continue fails with appropriate message if shelvedstate is corrupted
1729 1747 $ hg unshelve --continue
1730 1748 abort: corrupted shelved state file
1731 1749 (please run hg unshelve --abort to abort unshelve operation)
1732 1750 [255]
1733 1751
1734 1752 Unshelve --abort works with a corrupted shelvedstate
1735 1753 $ hg unshelve --abort
1736 1754 could not read shelved state file, your working copy may be in an unexpected state
1737 1755 please update to some commit
1738 1756
1739 1757 Unshelve --abort fails with appropriate message if there's no unshelve in
1740 1758 progress
1741 1759 $ hg unshelve --abort
1742 1760 abort: no unshelve in progress
1743 1761 [255]
1744 1762 $ cd ..
1745 1763
1746 1764 Unshelve respects --keep even if user intervention is needed
1747 1765 $ hg init unshelvekeep && cd unshelvekeep
1748 1766 $ echo 1 > file && hg ci -Am 1
1749 1767 adding file
1750 1768 $ echo 2 >> file
1751 1769 $ hg shelve
1752 1770 shelved as default
1753 1771 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1754 1772 $ echo 3 >> file && hg ci -Am 13
1755 1773 $ hg shelve --list
1756 1774 default (*s ago) * changes to: 1 (glob)
1757 1775 $ hg unshelve --keep
1758 1776 unshelving change 'default'
1759 1777 rebasing shelved changes
1760 1778 merging file
1761 1779 warning: conflicts while merging file! (edit, then use 'hg resolve --mark')
1762 1780 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1763 1781 [1]
1764 1782 $ hg resolve --mark file
1765 1783 (no more unresolved files)
1766 1784 continue: hg unshelve --continue
1767 1785 $ hg unshelve --continue
1768 1786 unshelve of 'default' complete
1769 1787 $ hg shelve --list
1770 1788 default (*s ago) * changes to: 1 (glob)
1771 1789 $ cd ..
1772 1790
1773 1791 Unshelving when there are deleted files does not crash (issue4176)
1774 1792 $ hg init unshelve-deleted-file && cd unshelve-deleted-file
1775 1793 $ echo a > a && echo b > b && hg ci -Am ab
1776 1794 adding a
1777 1795 adding b
1778 1796 $ echo aa > a && hg shelve
1779 1797 shelved as default
1780 1798 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1781 1799 $ rm b
1782 1800 $ hg st
1783 1801 ! b
1784 1802 $ hg unshelve
1785 1803 unshelving change 'default'
1786 1804 $ hg shelve
1787 1805 shelved as default
1788 1806 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1789 1807 $ rm a && echo b > b
1790 1808 $ hg st
1791 1809 ! a
1792 1810 $ hg unshelve
1793 1811 unshelving change 'default'
1794 1812 abort: shelved change touches missing files
1795 1813 (run hg status to see which files are missing)
1796 1814 [255]
1797 1815 $ hg st
1798 1816 ! a
1799 1817 $ cd ..
1800 1818
1801 1819 New versions of Mercurial know how to read onld shelvedstate files
1802 1820 $ hg init oldshelvedstate
1803 1821 $ cd oldshelvedstate
1804 1822 $ echo root > root && hg ci -Am root
1805 1823 adding root
1806 1824 $ echo 1 > a
1807 1825 $ hg add a
1808 1826 $ hg shelve --name ashelve
1809 1827 shelved as ashelve
1810 1828 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1811 1829 $ echo 2 > a
1812 1830 $ hg ci -Am a
1813 1831 adding a
1814 1832 $ hg unshelve
1815 1833 unshelving change 'ashelve'
1816 1834 rebasing shelved changes
1817 1835 merging a
1818 1836 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1819 1837 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1820 1838 [1]
1821 1839 putting v1 shelvedstate file in place of a created v2
1822 1840 $ cat << EOF > .hg/shelvedstate
1823 1841 > 1
1824 1842 > ashelve
1825 1843 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1826 1844 > 8b058dae057a5a78f393f4535d9e363dd5efac9d
1827 1845 > 8b058dae057a5a78f393f4535d9e363dd5efac9d f543b27db2cdb41737e2e0008dc524c471da1446
1828 1846 > f543b27db2cdb41737e2e0008dc524c471da1446
1829 1847 >
1830 1848 > nokeep
1831 1849 > :no-active-bookmark
1832 1850 > EOF
1833 1851 $ echo 1 > a
1834 1852 $ hg resolve --mark a
1835 1853 (no more unresolved files)
1836 1854 continue: hg unshelve --continue
1837 1855 mercurial does not crash
1838 1856 $ hg unshelve --continue
1839 1857 unshelve of 'ashelve' complete
1840 1858
1841 1859 #if phasebased
1842 1860
1843 1861 Unshelve without .shelve metadata:
1844 1862
1845 1863 $ hg shelve
1846 1864 shelved as default
1847 1865 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1848 1866 $ cat .hg/shelved/default.shelve
1849 1867 node=82e0cb9893247d12667017593ce1e5655860f1ac
1850 1868 $ hg strip --hidden --rev 82e0cb989324 --no-backup
1851 1869 $ rm .hg/shelved/default.shelve
1852 1870 $ echo 3 > a
1853 1871 $ hg unshelve
1854 1872 unshelving change 'default'
1855 1873 temporarily committing pending changes (restore with 'hg unshelve --abort')
1856 1874 rebasing shelved changes
1857 1875 merging a
1858 1876 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1859 1877 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
1860 1878 [1]
1861 1879 $ cat .hg/shelved/default.shelve
1862 1880 node=82e0cb9893247d12667017593ce1e5655860f1ac
1863 1881
1864 1882 #endif
1865 1883
1866 1884 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now