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