Mercurial > hg
comparison tests/test-shelve2.t @ 40852:1b836cee2d91
tests: split test-shelve.t in two
test-shelve.t dominated run time for all shelve tests.
Before:
# Ran 9 tests, 1 skipped, 0 failed.
real 0m43.568s
user 2m15.822s
sys 0m40.857s
After:
# Ran 11 tests, 1 skipped, 0 failed.
real 0m24.574s
user 2m21.354s
sys 0m40.435s
Differential Revision: https://phab.mercurial-scm.org/D5388
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 05 Dec 2018 14:46:09 -0800 |
parents | tests/test-shelve.t@d9ba836fc234 |
children | 7e09ffb3170d |
comparison
equal
deleted
inserted
replaced
40851:74e3df766052 | 40852:1b836cee2d91 |
---|---|
1 #testcases stripbased phasebased | |
2 | |
3 $ cat <<EOF >> $HGRCPATH | |
4 > [extensions] | |
5 > mq = | |
6 > shelve = | |
7 > [defaults] | |
8 > diff = --nodates --git | |
9 > qnew = --date '0 0' | |
10 > [shelve] | |
11 > maxbackups = 2 | |
12 > EOF | |
13 | |
14 #if phasebased | |
15 | |
16 $ cat <<EOF >> $HGRCPATH | |
17 > [format] | |
18 > internal-phase = yes | |
19 > EOF | |
20 | |
21 #endif | |
22 | |
23 shelve should leave dirstate clean (issue4055) | |
24 | |
25 $ hg init shelverebase | |
26 $ cd shelverebase | |
27 $ printf 'x\ny\n' > x | |
28 $ echo z > z | |
29 $ hg commit -Aqm xy | |
30 $ echo z >> x | |
31 $ hg commit -Aqm z | |
32 $ hg up 5c4c67fb7dce | |
33 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 $ printf 'a\nx\ny\nz\n' > x | |
35 $ hg commit -Aqm xyz | |
36 $ echo c >> z | |
37 $ hg shelve | |
38 shelved as default | |
39 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
40 | |
41 $ hg rebase -d 6c103be8f4e4 --config extensions.rebase= | |
42 rebasing 2:323bfa07f744 "xyz"( \(tip\))? (re) | |
43 merging x | |
44 saved backup bundle to \$TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-(78114325|7ae538ef)-rebase.hg (re) | |
45 $ hg unshelve | |
46 unshelving change 'default' | |
47 rebasing shelved changes | |
48 $ hg status | |
49 M z | |
50 | |
51 $ cd .. | |
52 | |
53 shelve should only unshelve pending changes (issue4068) | |
54 | |
55 $ hg init onlypendingchanges | |
56 $ cd onlypendingchanges | |
57 $ touch a | |
58 $ hg ci -Aqm a | |
59 $ touch b | |
60 $ hg ci -Aqm b | |
61 $ hg up -q 3903775176ed | |
62 $ touch c | |
63 $ hg ci -Aqm c | |
64 | |
65 $ touch d | |
66 $ hg add d | |
67 $ hg shelve | |
68 shelved as default | |
69 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
70 $ hg up -q 0e067c57feba | |
71 $ hg unshelve | |
72 unshelving change 'default' | |
73 rebasing shelved changes | |
74 $ hg status | |
75 A d | |
76 | |
77 unshelve should work on an ancestor of the original commit | |
78 | |
79 $ hg shelve | |
80 shelved as default | |
81 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
82 $ hg up 3903775176ed | |
83 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
84 $ hg unshelve | |
85 unshelving change 'default' | |
86 rebasing shelved changes | |
87 $ hg status | |
88 A d | |
89 | |
90 test bug 4073 we need to enable obsolete markers for it | |
91 | |
92 $ cat >> $HGRCPATH << EOF | |
93 > [experimental] | |
94 > evolution.createmarkers=True | |
95 > EOF | |
96 $ hg shelve | |
97 shelved as default | |
98 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
99 $ hg debugobsolete `hg log -r 0e067c57feba -T '{node}'` | |
100 obsoleted 1 changesets | |
101 $ hg unshelve | |
102 unshelving change 'default' | |
103 | |
104 unshelve should leave unknown files alone (issue4113) | |
105 | |
106 $ echo e > e | |
107 $ hg shelve | |
108 shelved as default | |
109 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
110 $ hg status | |
111 ? e | |
112 $ hg unshelve | |
113 unshelving change 'default' | |
114 $ hg status | |
115 A d | |
116 ? e | |
117 $ cat e | |
118 e | |
119 | |
120 unshelve should keep a copy of unknown files | |
121 | |
122 $ hg add e | |
123 $ hg shelve | |
124 shelved as default | |
125 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
126 $ echo z > e | |
127 $ hg unshelve | |
128 unshelving change 'default' | |
129 $ cat e | |
130 e | |
131 $ cat e.orig | |
132 z | |
133 | |
134 | |
135 unshelve and conflicts with tracked and untracked files | |
136 | |
137 preparing: | |
138 | |
139 $ rm *.orig | |
140 $ hg ci -qm 'commit stuff' | |
141 $ hg phase -p null: | |
142 | |
143 no other changes - no merge: | |
144 | |
145 $ echo f > f | |
146 $ hg add f | |
147 $ hg shelve | |
148 shelved as default | |
149 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
150 $ echo g > f | |
151 $ hg unshelve | |
152 unshelving change 'default' | |
153 $ hg st | |
154 A f | |
155 ? f.orig | |
156 $ cat f | |
157 f | |
158 $ cat f.orig | |
159 g | |
160 | |
161 other uncommitted changes - merge: | |
162 | |
163 $ hg st | |
164 A f | |
165 ? f.orig | |
166 $ hg shelve | |
167 shelved as default | |
168 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
169 #if repobundlerepo | |
170 $ hg log -G --template '{rev} {desc|firstline} {author}' -R bundle://.hg/shelved/default.hg -r 'bundle()' --hidden | |
171 o [48] changes to: commit stuff shelve@localhost (re) | |
172 | | |
173 ~ | |
174 #endif | |
175 $ hg log -G --template '{rev} {desc|firstline} {author}' | |
176 @ [37] commit stuff test (re) | |
177 | | |
178 | o 2 c test | |
179 |/ | |
180 o 0 a test | |
181 | |
182 $ mv f.orig f | |
183 $ echo 1 > a | |
184 $ hg unshelve --date '1073741824 0' | |
185 unshelving change 'default' | |
186 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
187 rebasing shelved changes | |
188 merging f | |
189 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
190 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
191 [1] | |
192 | |
193 #if phasebased | |
194 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}' | |
195 @ 9 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000 | |
196 | | |
197 | @ 8 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000 | |
198 |/ | |
199 o 7 commit stuff test 1970-01-01 00:00 +0000 | |
200 | | |
201 | o 2 c test 1970-01-01 00:00 +0000 | |
202 |/ | |
203 o 0 a test 1970-01-01 00:00 +0000 | |
204 | |
205 #endif | |
206 | |
207 #if stripbased | |
208 $ hg log -G --template '{rev} {desc|firstline} {author} {date|isodate}' | |
209 @ 5 changes to: commit stuff shelve@localhost 1970-01-01 00:00 +0000 | |
210 | | |
211 | @ 4 pending changes temporary commit shelve@localhost 2004-01-10 13:37 +0000 | |
212 |/ | |
213 o 3 commit stuff test 1970-01-01 00:00 +0000 | |
214 | | |
215 | o 2 c test 1970-01-01 00:00 +0000 | |
216 |/ | |
217 o 0 a test 1970-01-01 00:00 +0000 | |
218 | |
219 #endif | |
220 | |
221 $ hg st | |
222 M f | |
223 ? f.orig | |
224 $ cat f | |
225 <<<<<<< shelve: d44eae5c3d33 - shelve: pending changes temporary commit | |
226 g | |
227 ======= | |
228 f | |
229 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff | |
230 $ cat f.orig | |
231 g | |
232 $ hg unshelve --abort -t false | |
233 tool option will be ignored | |
234 unshelve of 'default' aborted | |
235 $ hg st | |
236 M a | |
237 ? f.orig | |
238 $ cat f.orig | |
239 g | |
240 $ hg unshelve | |
241 unshelving change 'default' | |
242 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
243 rebasing shelved changes | |
244 $ hg st | |
245 M a | |
246 A f | |
247 ? f.orig | |
248 | |
249 other committed changes - merge: | |
250 | |
251 $ hg shelve f | |
252 shelved as default | |
253 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
254 $ hg ci a -m 'intermediate other change' | |
255 $ mv f.orig f | |
256 $ hg unshelve | |
257 unshelving change 'default' | |
258 rebasing shelved changes | |
259 merging f | |
260 warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
261 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
262 [1] | |
263 $ hg st | |
264 M f | |
265 ? f.orig | |
266 $ cat f | |
267 <<<<<<< shelve: 6b563750f973 - test: intermediate other change | |
268 g | |
269 ======= | |
270 f | |
271 >>>>>>> working-copy: aef214a5229c - shelve: changes to: commit stuff | |
272 $ cat f.orig | |
273 g | |
274 $ hg unshelve --abort | |
275 unshelve of 'default' aborted | |
276 $ hg st | |
277 ? f.orig | |
278 $ cat f.orig | |
279 g | |
280 $ hg shelve --delete default | |
281 $ cd .. | |
282 | |
283 you shouldn't be able to ask for the patch/stats of the most recent shelve if | |
284 there are no shelves | |
285 | |
286 $ hg init noshelves | |
287 $ cd noshelves | |
288 | |
289 $ hg shelve --patch | |
290 abort: there are no shelves to show | |
291 [255] | |
292 $ hg shelve --stat | |
293 abort: there are no shelves to show | |
294 [255] | |
295 | |
296 $ cd .. | |
297 | |
298 test .orig files go where the user wants them to | |
299 --------------------------------------------------------------- | |
300 $ hg init salvage | |
301 $ cd salvage | |
302 $ echo 'content' > root | |
303 $ hg commit -A -m 'root' -q | |
304 $ echo '' > root | |
305 $ hg shelve -q | |
306 $ echo 'contADDent' > root | |
307 $ hg unshelve -q --config 'ui.origbackuppath=.hg/origbackups' | |
308 warning: conflicts while merging root! (edit, then use 'hg resolve --mark') | |
309 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
310 [1] | |
311 $ ls .hg/origbackups | |
312 root | |
313 $ rm -rf .hg/origbackups | |
314 | |
315 test Abort unshelve always gets user out of the unshelved state | |
316 --------------------------------------------------------------- | |
317 | |
318 with a corrupted shelve state file | |
319 $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > ../corrupt-shelvedstate | |
320 $ mv ../corrupt-shelvedstate .hg/shelvestate | |
321 $ hg unshelve --abort 2>&1 | grep 'aborted' | |
322 unshelve of 'default' aborted | |
323 $ hg summary | |
324 parent: 0:ae8c668541e8 tip | |
325 root | |
326 branch: default | |
327 commit: 1 modified | |
328 update: (current) | |
329 phases: 1 draft | |
330 $ hg up -C . | |
331 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
332 | |
333 $ cd .. | |
334 | |
335 Shelve and unshelve unknown files. For the purposes of unshelve, a shelved | |
336 unknown file is the same as a shelved added file, except that it will be in | |
337 unknown state after unshelve if and only if it was either absent or unknown | |
338 before the unshelve operation. | |
339 | |
340 $ hg init unknowns | |
341 $ cd unknowns | |
342 | |
343 The simplest case is if I simply have an unknown file that I shelve and unshelve | |
344 | |
345 $ echo unknown > unknown | |
346 $ hg status | |
347 ? unknown | |
348 $ hg shelve --unknown | |
349 shelved as default | |
350 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
351 $ hg status | |
352 $ hg unshelve | |
353 unshelving change 'default' | |
354 $ hg status | |
355 ? unknown | |
356 $ rm unknown | |
357 | |
358 If I shelve, add the file, and unshelve, does it stay added? | |
359 | |
360 $ echo unknown > unknown | |
361 $ hg shelve -u | |
362 shelved as default | |
363 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
364 $ hg status | |
365 $ touch unknown | |
366 $ hg add unknown | |
367 $ hg status | |
368 A unknown | |
369 $ hg unshelve | |
370 unshelving change 'default' | |
371 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
372 rebasing shelved changes | |
373 merging unknown | |
374 $ hg status | |
375 A unknown | |
376 $ hg forget unknown | |
377 $ rm unknown | |
378 | |
379 And if I shelve, commit, then unshelve, does it become modified? | |
380 | |
381 $ echo unknown > unknown | |
382 $ hg shelve -u | |
383 shelved as default | |
384 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
385 $ hg status | |
386 $ touch unknown | |
387 $ hg add unknown | |
388 $ hg commit -qm "Add unknown" | |
389 $ hg status | |
390 $ hg unshelve | |
391 unshelving change 'default' | |
392 rebasing shelved changes | |
393 merging unknown | |
394 $ hg status | |
395 M unknown | |
396 $ hg remove --force unknown | |
397 $ hg commit -qm "Remove unknown" | |
398 | |
399 $ cd .. | |
400 | |
401 We expects that non-bare shelve keeps newly created branch in | |
402 working directory. | |
403 | |
404 $ hg init shelve-preserve-new-branch | |
405 $ cd shelve-preserve-new-branch | |
406 $ echo "a" >> a | |
407 $ hg add a | |
408 $ echo "b" >> b | |
409 $ hg add b | |
410 $ hg commit -m "ab" | |
411 $ echo "aa" >> a | |
412 $ echo "bb" >> b | |
413 $ hg branch new-branch | |
414 marked working directory as branch new-branch | |
415 (branches are permanent and global, did you want a bookmark?) | |
416 $ hg status | |
417 M a | |
418 M b | |
419 $ hg branch | |
420 new-branch | |
421 $ hg shelve a | |
422 shelved as default | |
423 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
424 $ hg branch | |
425 new-branch | |
426 $ hg status | |
427 M b | |
428 $ touch "c" >> c | |
429 $ hg add c | |
430 $ hg status | |
431 M b | |
432 A c | |
433 $ hg shelve --exclude c | |
434 shelved as default-01 | |
435 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
436 $ hg branch | |
437 new-branch | |
438 $ hg status | |
439 A c | |
440 $ hg shelve --include c | |
441 shelved as default-02 | |
442 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
443 $ hg branch | |
444 new-branch | |
445 $ hg status | |
446 $ echo "d" >> d | |
447 $ hg add d | |
448 $ hg status | |
449 A d | |
450 | |
451 We expect that bare-shelve will not keep branch in current working directory. | |
452 | |
453 $ hg shelve | |
454 shelved as default-03 | |
455 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
456 $ hg branch | |
457 default | |
458 $ cd .. | |
459 | |
460 When i shelve commit on newly created branch i expect | |
461 that after unshelve newly created branch will be preserved. | |
462 | |
463 $ hg init shelve_on_new_branch_simple | |
464 $ cd shelve_on_new_branch_simple | |
465 $ echo "aaa" >> a | |
466 $ hg commit -A -m "a" | |
467 adding a | |
468 $ hg branch | |
469 default | |
470 $ hg branch test | |
471 marked working directory as branch test | |
472 (branches are permanent and global, did you want a bookmark?) | |
473 $ echo "bbb" >> a | |
474 $ hg status | |
475 M a | |
476 $ hg shelve | |
477 shelved as default | |
478 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
479 $ hg branch | |
480 default | |
481 $ echo "bbb" >> b | |
482 $ hg status | |
483 ? b | |
484 $ hg unshelve | |
485 unshelving change 'default' | |
486 marked working directory as branch test | |
487 $ hg status | |
488 M a | |
489 ? b | |
490 $ hg branch | |
491 test | |
492 $ cd .. | |
493 | |
494 When i shelve commit on newly created branch, make | |
495 some changes, unshelve it and running into merge | |
496 conflicts i expect that after fixing them and | |
497 running unshelve --continue newly created branch | |
498 will be preserved. | |
499 | |
500 $ hg init shelve_on_new_branch_conflict | |
501 $ cd shelve_on_new_branch_conflict | |
502 $ echo "aaa" >> a | |
503 $ hg commit -A -m "a" | |
504 adding a | |
505 $ hg branch | |
506 default | |
507 $ hg branch test | |
508 marked working directory as branch test | |
509 (branches are permanent and global, did you want a bookmark?) | |
510 $ echo "bbb" >> a | |
511 $ hg status | |
512 M a | |
513 $ hg shelve | |
514 shelved as default | |
515 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
516 $ hg branch | |
517 default | |
518 $ echo "ccc" >> a | |
519 $ hg status | |
520 M a | |
521 $ hg unshelve | |
522 unshelving change 'default' | |
523 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
524 rebasing shelved changes | |
525 merging a | |
526 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
527 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
528 [1] | |
529 $ echo "aaabbbccc" > a | |
530 $ rm a.orig | |
531 $ hg resolve --mark a | |
532 (no more unresolved files) | |
533 continue: hg unshelve --continue | |
534 $ hg unshelve --continue | |
535 marked working directory as branch test | |
536 unshelve of 'default' complete | |
537 $ cat a | |
538 aaabbbccc | |
539 $ hg status | |
540 M a | |
541 $ hg branch | |
542 test | |
543 $ hg commit -m "test-commit" | |
544 | |
545 When i shelve on test branch, update to default branch | |
546 and unshelve i expect that it will not preserve previous | |
547 test branch. | |
548 | |
549 $ echo "xxx" > b | |
550 $ hg add b | |
551 $ hg shelve | |
552 shelved as test | |
553 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
554 $ hg update -r 7049e48789d7 | |
555 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
556 $ hg unshelve | |
557 unshelving change 'test' | |
558 rebasing shelved changes | |
559 $ hg status | |
560 A b | |
561 $ hg branch | |
562 default | |
563 $ cd .. | |
564 | |
565 When i unshelve resulting in merge conflicts and makes saved | |
566 file shelvedstate looks like in previous versions in | |
567 mercurial(without restore branch information in 7th line) i | |
568 expect that after resolving conflicts and successfully | |
569 running 'shelve --continue' the branch information won't be | |
570 restored and branch will be unchanged. | |
571 | |
572 shelve on new branch, conflict with previous shelvedstate | |
573 | |
574 $ hg init conflict | |
575 $ cd conflict | |
576 $ echo "aaa" >> a | |
577 $ hg commit -A -m "a" | |
578 adding a | |
579 $ hg branch | |
580 default | |
581 $ hg branch test | |
582 marked working directory as branch test | |
583 (branches are permanent and global, did you want a bookmark?) | |
584 $ echo "bbb" >> a | |
585 $ hg status | |
586 M a | |
587 $ hg shelve | |
588 shelved as default | |
589 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
590 $ hg branch | |
591 default | |
592 $ echo "ccc" >> a | |
593 $ hg status | |
594 M a | |
595 $ hg unshelve | |
596 unshelving change 'default' | |
597 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
598 rebasing shelved changes | |
599 merging a | |
600 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
601 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
602 [1] | |
603 | |
604 Removing restore branch information from shelvedstate file(making it looks like | |
605 in previous versions) and running unshelve --continue | |
606 | |
607 $ cp .hg/shelvedstate .hg/shelvedstate_old | |
608 $ cat .hg/shelvedstate_old | grep -v 'branchtorestore' > .hg/shelvedstate | |
609 | |
610 $ echo "aaabbbccc" > a | |
611 $ rm a.orig | |
612 $ hg resolve --mark a | |
613 (no more unresolved files) | |
614 continue: hg unshelve --continue | |
615 $ hg unshelve --continue | |
616 unshelve of 'default' complete | |
617 $ cat a | |
618 aaabbbccc | |
619 $ hg status | |
620 M a | |
621 $ hg branch | |
622 default | |
623 $ cd .. | |
624 | |
625 On non bare shelve the branch information shouldn't be restored | |
626 | |
627 $ hg init bare_shelve_on_new_branch | |
628 $ cd bare_shelve_on_new_branch | |
629 $ echo "aaa" >> a | |
630 $ hg commit -A -m "a" | |
631 adding a | |
632 $ hg branch | |
633 default | |
634 $ hg branch test | |
635 marked working directory as branch test | |
636 (branches are permanent and global, did you want a bookmark?) | |
637 $ echo "bbb" >> a | |
638 $ hg status | |
639 M a | |
640 $ hg shelve a | |
641 shelved as default | |
642 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
643 $ hg branch | |
644 test | |
645 $ hg branch default | |
646 marked working directory as branch default | |
647 (branches are permanent and global, did you want a bookmark?) | |
648 $ echo "bbb" >> b | |
649 $ hg status | |
650 ? b | |
651 $ hg unshelve | |
652 unshelving change 'default' | |
653 $ hg status | |
654 M a | |
655 ? b | |
656 $ hg branch | |
657 default | |
658 $ cd .. | |
659 | |
660 Prepare unshelve with a corrupted shelvedstate | |
661 $ hg init r1 && cd r1 | |
662 $ echo text1 > file && hg add file | |
663 $ hg shelve | |
664 shelved as default | |
665 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
666 $ echo text2 > file && hg ci -Am text1 | |
667 adding file | |
668 $ hg unshelve | |
669 unshelving change 'default' | |
670 rebasing shelved changes | |
671 merging file | |
672 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |
673 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
674 [1] | |
675 $ echo somethingsomething > .hg/shelvedstate | |
676 | |
677 Unshelve --continue fails with appropriate message if shelvedstate is corrupted | |
678 $ hg unshelve --continue | |
679 abort: corrupted shelved state file | |
680 (please run hg unshelve --abort to abort unshelve operation) | |
681 [255] | |
682 | |
683 Unshelve --abort works with a corrupted shelvedstate | |
684 $ hg unshelve --abort | |
685 could not read shelved state file, your working copy may be in an unexpected state | |
686 please update to some commit | |
687 | |
688 Unshelve --abort fails with appropriate message if there's no unshelve in | |
689 progress | |
690 $ hg unshelve --abort | |
691 abort: no unshelve in progress | |
692 [255] | |
693 $ cd .. | |
694 | |
695 Unshelve respects --keep even if user intervention is needed | |
696 $ hg init unshelvekeep && cd unshelvekeep | |
697 $ echo 1 > file && hg ci -Am 1 | |
698 adding file | |
699 $ echo 2 >> file | |
700 $ hg shelve | |
701 shelved as default | |
702 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
703 $ echo 3 >> file && hg ci -Am 13 | |
704 $ hg shelve --list | |
705 default (*s ago) * changes to: 1 (glob) | |
706 $ hg unshelve --keep | |
707 unshelving change 'default' | |
708 rebasing shelved changes | |
709 merging file | |
710 warning: conflicts while merging file! (edit, then use 'hg resolve --mark') | |
711 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
712 [1] | |
713 $ hg resolve --mark file | |
714 (no more unresolved files) | |
715 continue: hg unshelve --continue | |
716 $ hg unshelve --continue | |
717 unshelve of 'default' complete | |
718 $ hg shelve --list | |
719 default (*s ago) * changes to: 1 (glob) | |
720 $ cd .. | |
721 | |
722 Unshelving when there are deleted files does not crash (issue4176) | |
723 $ hg init unshelve-deleted-file && cd unshelve-deleted-file | |
724 $ echo a > a && echo b > b && hg ci -Am ab | |
725 adding a | |
726 adding b | |
727 $ echo aa > a && hg shelve | |
728 shelved as default | |
729 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
730 $ rm b | |
731 $ hg st | |
732 ! b | |
733 $ hg unshelve | |
734 unshelving change 'default' | |
735 $ hg shelve | |
736 shelved as default | |
737 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
738 $ rm a && echo b > b | |
739 $ hg st | |
740 ! a | |
741 $ hg unshelve | |
742 unshelving change 'default' | |
743 abort: shelved change touches missing files | |
744 (run hg status to see which files are missing) | |
745 [255] | |
746 $ hg st | |
747 ! a | |
748 $ cd .. | |
749 | |
750 New versions of Mercurial know how to read onld shelvedstate files | |
751 $ hg init oldshelvedstate | |
752 $ cd oldshelvedstate | |
753 $ echo root > root && hg ci -Am root | |
754 adding root | |
755 $ echo 1 > a | |
756 $ hg add a | |
757 $ hg shelve --name ashelve | |
758 shelved as ashelve | |
759 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
760 $ echo 2 > a | |
761 $ hg ci -Am a | |
762 adding a | |
763 $ hg unshelve | |
764 unshelving change 'ashelve' | |
765 rebasing shelved changes | |
766 merging a | |
767 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
768 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
769 [1] | |
770 putting v1 shelvedstate file in place of a created v2 | |
771 $ cat << EOF > .hg/shelvedstate | |
772 > 1 | |
773 > ashelve | |
774 > 8b058dae057a5a78f393f4535d9e363dd5efac9d | |
775 > 8b058dae057a5a78f393f4535d9e363dd5efac9d | |
776 > 8b058dae057a5a78f393f4535d9e363dd5efac9d f543b27db2cdb41737e2e0008dc524c471da1446 | |
777 > f543b27db2cdb41737e2e0008dc524c471da1446 | |
778 > | |
779 > nokeep | |
780 > :no-active-bookmark | |
781 > EOF | |
782 $ echo 1 > a | |
783 $ hg resolve --mark a | |
784 (no more unresolved files) | |
785 continue: hg unshelve --continue | |
786 mercurial does not crash | |
787 $ hg unshelve --continue | |
788 unshelve of 'ashelve' complete | |
789 | |
790 #if phasebased | |
791 | |
792 Unshelve with some metadata file missing | |
793 ---------------------------------------- | |
794 | |
795 $ hg shelve | |
796 shelved as default | |
797 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
798 $ echo 3 > a | |
799 | |
800 Test with the `.shelve` missing, but the changeset still in the repo (non-natural case) | |
801 | |
802 $ rm .hg/shelved/default.shelve | |
803 $ hg unshelve | |
804 unshelving change 'default' | |
805 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
806 rebasing shelved changes | |
807 merging a | |
808 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
809 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
810 [1] | |
811 $ hg unshelve --abort | |
812 unshelve of 'default' aborted | |
813 | |
814 Unshelve without .shelve metadata (can happen when upgrading a repository with old shelve) | |
815 | |
816 $ cat .hg/shelved/default.shelve | |
817 node=82e0cb9893247d12667017593ce1e5655860f1ac | |
818 $ hg strip --hidden --rev 82e0cb989324 --no-backup | |
819 $ rm .hg/shelved/default.shelve | |
820 $ hg unshelve | |
821 unshelving change 'default' | |
822 temporarily committing pending changes (restore with 'hg unshelve --abort') | |
823 rebasing shelved changes | |
824 merging a | |
825 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | |
826 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') | |
827 [1] | |
828 $ cat .hg/shelved/default.shelve | |
829 node=82e0cb9893247d12667017593ce1e5655860f1ac | |
830 $ hg unshelve --abort | |
831 unshelve of 'default' aborted | |
832 | |
833 #endif | |
834 | |
835 $ cd .. |