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