|
1 $ echo "[extensions]" >> $HGRCPATH |
|
2 $ echo "shelve=" >> $HGRCPATH |
|
3 $ echo "[defaults]" >> $HGRCPATH |
|
4 $ echo "diff = --nodates --git" >> $HGRCPATH |
|
5 |
|
6 $ hg init repo |
|
7 $ cd repo |
|
8 $ mkdir a b |
|
9 $ echo a > a/a |
|
10 $ echo b > b/b |
|
11 $ echo c > c |
|
12 $ echo d > d |
|
13 $ echo x > x |
|
14 $ hg addremove -q |
|
15 |
|
16 shelving in an empty repo should be possible |
|
17 |
|
18 $ hg shelve |
|
19 (empty repository) |
|
20 shelved as default |
|
21 0 files updated, 0 files merged, 5 files removed, 0 files unresolved |
|
22 |
|
23 $ hg unshelve |
|
24 unshelving change 'default' |
|
25 adding changesets |
|
26 adding manifests |
|
27 adding file changes |
|
28 added 1 changesets with 5 changes to 5 files |
|
29 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
30 |
|
31 $ hg commit -q -m 'initial commit' |
|
32 |
|
33 $ hg shelve |
|
34 nothing changed |
|
35 [1] |
|
36 |
|
37 create another commit |
|
38 |
|
39 $ echo n > n |
|
40 $ hg add n |
|
41 $ hg commit n -m second |
|
42 |
|
43 shelve a change that we will delete later |
|
44 |
|
45 $ echo a >> a/a |
|
46 $ hg shelve |
|
47 shelved from default (bb4fec6d): second |
|
48 shelved as default |
|
49 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
50 |
|
51 set up some more complex changes to shelve |
|
52 |
|
53 $ echo a >> a/a |
|
54 $ hg mv b b.rename |
|
55 moving b/b to b.rename/b (glob) |
|
56 $ hg cp c c.copy |
|
57 $ hg status -C |
|
58 M a/a |
|
59 A b.rename/b |
|
60 b/b |
|
61 A c.copy |
|
62 c |
|
63 R b/b |
|
64 |
|
65 prevent some foot-shooting |
|
66 |
|
67 $ hg shelve -n foo/bar |
|
68 abort: shelved change names may not contain slashes |
|
69 [255] |
|
70 $ hg shelve -n .baz |
|
71 abort: shelved change names may not start with '.' |
|
72 [255] |
|
73 |
|
74 the common case - no options or filenames |
|
75 |
|
76 $ hg shelve |
|
77 shelved from default (bb4fec6d): second |
|
78 shelved as default-01 |
|
79 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
80 $ hg status -C |
|
81 |
|
82 ensure that our shelved changes exist |
|
83 |
|
84 $ hg shelve -l |
|
85 default-01 [*] shelved from default (bb4fec6d): second (glob) |
|
86 default [*] shelved from default (bb4fec6d): second (glob) |
|
87 |
|
88 $ hg shelve -l -p default |
|
89 default [*] shelved from default (bb4fec6d): second (glob) |
|
90 |
|
91 diff --git a/a/a b/a/a |
|
92 --- a/a/a |
|
93 +++ b/a/a |
|
94 @@ -1,1 +1,2 @@ |
|
95 a |
|
96 +a |
|
97 |
|
98 delete our older shelved change |
|
99 |
|
100 $ hg shelve -d default |
|
101 |
|
102 local edits should prevent a shelved change from applying |
|
103 |
|
104 $ echo e>>a/a |
|
105 $ hg unshelve |
|
106 unshelving change 'default-01' |
|
107 the following shelved files have been modified: |
|
108 a/a |
|
109 you must commit, revert, or shelve your changes before you can proceed |
|
110 abort: cannot unshelve due to local changes |
|
111 |
|
112 [255] |
|
113 |
|
114 $ hg revert -C a/a |
|
115 |
|
116 apply it and make sure our state is as expected |
|
117 |
|
118 $ hg unshelve |
|
119 unshelving change 'default-01' |
|
120 adding changesets |
|
121 adding manifests |
|
122 adding file changes |
|
123 added 1 changesets with 3 changes to 8 files |
|
124 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
125 $ hg status -C |
|
126 M a/a |
|
127 A b.rename/b |
|
128 b/b |
|
129 A c.copy |
|
130 c |
|
131 R b/b |
|
132 $ hg shelve -l |
|
133 |
|
134 $ hg unshelve |
|
135 abort: no shelved changes to apply! |
|
136 [255] |
|
137 $ hg unshelve foo |
|
138 abort: shelved change 'foo' not found |
|
139 [255] |
|
140 |
|
141 named shelves, specific filenames, and "commit messages" should all work |
|
142 |
|
143 $ hg status -C |
|
144 M a/a |
|
145 A b.rename/b |
|
146 b/b |
|
147 A c.copy |
|
148 c |
|
149 R b/b |
|
150 $ hg shelve -q -n wibble -m wat a |
|
151 |
|
152 expect "a" to no longer be present, but status otherwise unchanged |
|
153 |
|
154 $ hg status -C |
|
155 A b.rename/b |
|
156 b/b |
|
157 A c.copy |
|
158 c |
|
159 R b/b |
|
160 $ hg shelve -l --stat |
|
161 wibble [*] wat (glob) |
|
162 a/a | 1 + |
|
163 1 files changed, 1 insertions(+), 0 deletions(-) |
|
164 |
|
165 and now "a/a" should reappear |
|
166 |
|
167 $ hg unshelve -q wibble |
|
168 $ hg status -C |
|
169 M a/a |
|
170 A b.rename/b |
|
171 b/b |
|
172 A c.copy |
|
173 c |
|
174 R b/b |
|
175 |
|
176 cause unshelving to result in a merge with 'a' conflicting |
|
177 |
|
178 $ hg shelve -q |
|
179 $ echo c>>a/a |
|
180 $ hg commit -m second |
|
181 $ hg tip --template '{files}\n' |
|
182 a/a |
|
183 |
|
184 add an unrelated change that should be preserved |
|
185 |
|
186 $ mkdir foo |
|
187 $ echo foo > foo/foo |
|
188 $ hg add foo/foo |
|
189 |
|
190 force a conflicted merge to occur |
|
191 |
|
192 $ hg unshelve |
|
193 unshelving change 'default' |
|
194 adding changesets |
|
195 adding manifests |
|
196 adding file changes |
|
197 added 1 changesets with 3 changes to 8 files (+1 heads) |
|
198 merging a/a |
|
199 warning: conflicts during merge. |
|
200 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
201 2 files updated, 0 files merged, 1 files removed, 1 files unresolved |
|
202 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon |
|
203 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
204 [1] |
|
205 |
|
206 ensure that we have a merge with unresolved conflicts |
|
207 |
|
208 $ hg heads -q |
|
209 3:7ec047b69dc0 |
|
210 2:ceefc37abe1e |
|
211 $ hg parents -q |
|
212 2:ceefc37abe1e |
|
213 3:7ec047b69dc0 |
|
214 $ hg status |
|
215 M a/a |
|
216 M b.rename/b |
|
217 M c.copy |
|
218 A foo/foo |
|
219 R b/b |
|
220 ? a/a.orig |
|
221 $ hg diff |
|
222 diff --git a/a/a b/a/a |
|
223 --- a/a/a |
|
224 +++ b/a/a |
|
225 @@ -1,2 +1,6 @@ |
|
226 a |
|
227 +<<<<<<< local |
|
228 c |
|
229 +======= |
|
230 +a |
|
231 +>>>>>>> other |
|
232 diff --git a/b.rename/b b/b.rename/b |
|
233 --- /dev/null |
|
234 +++ b/b.rename/b |
|
235 @@ -0,0 +1,1 @@ |
|
236 +b |
|
237 diff --git a/b/b b/b/b |
|
238 deleted file mode 100644 |
|
239 --- a/b/b |
|
240 +++ /dev/null |
|
241 @@ -1,1 +0,0 @@ |
|
242 -b |
|
243 diff --git a/c.copy b/c.copy |
|
244 --- /dev/null |
|
245 +++ b/c.copy |
|
246 @@ -0,0 +1,1 @@ |
|
247 +c |
|
248 diff --git a/foo/foo b/foo/foo |
|
249 new file mode 100644 |
|
250 --- /dev/null |
|
251 +++ b/foo/foo |
|
252 @@ -0,0 +1,1 @@ |
|
253 +foo |
|
254 $ hg resolve -l |
|
255 U a/a |
|
256 |
|
257 $ hg shelve |
|
258 abort: unshelve already in progress |
|
259 (use 'hg unshelve --continue' or 'hg unshelve --abort') |
|
260 [255] |
|
261 |
|
262 abort the unshelve and be happy |
|
263 |
|
264 $ hg status |
|
265 M a/a |
|
266 M b.rename/b |
|
267 M c.copy |
|
268 A foo/foo |
|
269 R b/b |
|
270 ? a/a.orig |
|
271 $ hg unshelve -a |
|
272 unshelve of 'default' aborted |
|
273 $ hg heads -q |
|
274 2:ceefc37abe1e |
|
275 $ hg parents |
|
276 changeset: 2:ceefc37abe1e |
|
277 tag: tip |
|
278 user: test |
|
279 date: Thu Jan 01 00:00:00 1970 +0000 |
|
280 summary: second |
|
281 |
|
282 $ hg resolve -l |
|
283 $ hg status |
|
284 A foo/foo |
|
285 ? a/a.orig |
|
286 |
|
287 try to continue with no unshelve underway |
|
288 |
|
289 $ hg unshelve -c |
|
290 abort: no unshelve operation underway |
|
291 [255] |
|
292 $ hg status |
|
293 A foo/foo |
|
294 ? a/a.orig |
|
295 |
|
296 redo the unshelve to get a conflict |
|
297 |
|
298 $ hg unshelve -q |
|
299 warning: conflicts during merge. |
|
300 merging a/a incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
301 unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
|
302 [1] |
|
303 |
|
304 attempt to continue |
|
305 |
|
306 $ hg unshelve -c |
|
307 abort: unresolved conflicts, can't continue |
|
308 (see 'hg resolve', then 'hg unshelve --continue') |
|
309 [255] |
|
310 |
|
311 $ hg revert -r . a/a |
|
312 $ hg resolve -m a/a |
|
313 |
|
314 $ hg unshelve -c |
|
315 unshelve of 'default' complete |
|
316 |
|
317 ensure the repo is as we hope |
|
318 |
|
319 $ hg parents |
|
320 changeset: 2:ceefc37abe1e |
|
321 tag: tip |
|
322 user: test |
|
323 date: Thu Jan 01 00:00:00 1970 +0000 |
|
324 summary: second |
|
325 |
|
326 $ hg heads -q |
|
327 2:ceefc37abe1e |
|
328 |
|
329 $ hg status -C |
|
330 M a/a |
|
331 M b.rename/b |
|
332 b/b |
|
333 M c.copy |
|
334 c |
|
335 A foo/foo |
|
336 R b/b |
|
337 ? a/a.orig |
|
338 |
|
339 there should be no shelves left |
|
340 |
|
341 $ hg shelve -l |
|
342 |
|
343 $ hg commit -m whee a/a |
|
344 |
|
345 #if execbit |
|
346 |
|
347 ensure that metadata-only changes are shelved |
|
348 |
|
349 $ chmod +x a/a |
|
350 $ hg shelve -q -n execbit a/a |
|
351 $ hg status a/a |
|
352 $ hg unshelve -q execbit |
|
353 $ hg status a/a |
|
354 M a/a |
|
355 $ hg revert a/a |
|
356 |
|
357 #endif |
|
358 |
|
359 #if symlink |
|
360 |
|
361 $ rm a/a |
|
362 $ ln -s foo a/a |
|
363 $ hg shelve -q -n symlink a/a |
|
364 $ hg status a/a |
|
365 $ hg unshelve -q symlink |
|
366 $ hg status a/a |
|
367 M a/a |
|
368 $ hg revert a/a |
|
369 |
|
370 #endif |
|
371 |
|
372 set up another conflict between a commit and a shelved change |
|
373 |
|
374 $ hg revert -q -C -a |
|
375 $ echo a >> a/a |
|
376 $ hg shelve -q |
|
377 $ echo x >> a/a |
|
378 $ hg ci -m 'create conflict' |
|
379 $ hg add foo/foo |
|
380 |
|
381 if we resolve a conflict while unshelving, the unshelve should succeed |
|
382 |
|
383 $ HGMERGE=true hg unshelve |
|
384 unshelving change 'default' |
|
385 adding changesets |
|
386 adding manifests |
|
387 adding file changes |
|
388 added 1 changesets with 1 changes to 6 files (+1 heads) |
|
389 merging a/a |
|
390 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
391 $ hg parents -q |
|
392 4:be7e79683c99 |
|
393 $ hg shelve -l |
|
394 $ hg status |
|
395 M a/a |
|
396 A foo/foo |
|
397 $ cat a/a |
|
398 a |
|
399 c |
|
400 x |
|
401 |
|
402 test keep and cleanup |
|
403 |
|
404 $ hg shelve |
|
405 shelved from default (be7e7968): create conflict |
|
406 shelved as default |
|
407 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
408 $ hg shelve --list |
|
409 default [*] shelved from default (be7e7968): create conflict (glob) |
|
410 $ hg unshelve --keep |
|
411 unshelving change 'default' |
|
412 adding changesets |
|
413 adding manifests |
|
414 adding file changes |
|
415 added 1 changesets with 1 changes to 7 files |
|
416 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
417 $ hg shelve --list |
|
418 default [*] shelved from default (be7e7968): create conflict (glob) |
|
419 $ hg shelve --cleanup |
|
420 $ hg shelve --list |