comparison tests/test-shelve.t @ 44209:ae4d729eb3c8

tests: add test showing crash when shelving ghosted rename target When you `hg rename` a file and then delete the rename target, `hg shelve` will give you a traceback. Note that the shelve succeeds and the shelve is correct, it's just the update to the parent that fails (i.e. to the parent of the commit that was created for the shelve). This can be squashed into the next commit if the reviewer prefers. Differential Revision: https://phab.mercurial-scm.org/D8045
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 29 Jan 2020 23:05:02 -0800
parents 4330851947fb
children d0c3eead515a
comparison
equal deleted inserted replaced
44207:e960c30d7e50 44209:ae4d729eb3c8
169 169
170 $ echo a >> a/a 170 $ echo a >> a/a
171 $ hg mv b b.rename 171 $ hg mv b b.rename
172 moving b/b to b.rename/b 172 moving b/b to b.rename/b
173 $ hg cp c c.copy 173 $ hg cp c c.copy
174 $ hg mv d ghost
175 $ rm ghost
174 $ hg status -C 176 $ hg status -C
175 M a/a 177 M a/a
176 A b.rename/b 178 A b.rename/b
177 b/b 179 b/b
178 A c.copy 180 A c.copy
179 c 181 c
180 R b/b 182 R b/b
183 R d
184 ! ghost
185 d
181 186
182 the common case - no options or filenames 187 the common case - no options or filenames
183 188
184 $ hg shelve 189 $ hg shelve 2>&1 | grep KeyError
185 shelved as default-01 190 KeyError: 'No such manifest entry.' (no-pure !)
186 2 files updated, 0 files merged, 2 files removed, 0 files unresolved 191 raise KeyError (pure !)
192 KeyError (pure !)
193 # Get out of the broken state so later tests work
194 $ hg forget b.rename/b c.copy ghost
195 $ hg revert a/a b/b d
196 $ rm a/a.orig b.rename/b c.copy
187 $ hg status -C 197 $ hg status -C
188 198
189 ensure that our shelved changes exist 199 ensure that our shelved changes exist
190 200
191 $ hg shelve -l 201 $ hg shelve -l
252 A b.rename/b 262 A b.rename/b
253 b/b 263 b/b
254 A c.copy 264 A c.copy
255 c 265 c
256 R b/b 266 R b/b
267 R d
257 $ hg shelve -l 268 $ hg shelve -l
258 269
259 (both of default.hg and default-1.hg should be still kept, because it 270 (both of default.hg and default-1.hg should be still kept, because it
260 is difficult to decide actual order of them from same timestamp) 271 is difficult to decide actual order of them from same timestamp)
261 272
285 A b.rename/b 296 A b.rename/b
286 b/b 297 b/b
287 A c.copy 298 A c.copy
288 c 299 c
289 R b/b 300 R b/b
301 R d
290 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a 302 $ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a
291 wat 303 wat
292 304
293 305
294 HG: Enter commit message. Lines beginning with 'HG:' are removed. 306 HG: Enter commit message. Lines beginning with 'HG:' are removed.
304 A b.rename/b 316 A b.rename/b
305 b/b 317 b/b
306 A c.copy 318 A c.copy
307 c 319 c
308 R b/b 320 R b/b
321 R d
309 $ hg shelve -l --stat 322 $ hg shelve -l --stat
310 wibble (*) wat (glob) 323 wibble (*) wat (glob)
311 a/a | 1 + 324 a/a | 1 +
312 1 files changed, 1 insertions(+), 0 deletions(-) 325 1 files changed, 1 insertions(+), 0 deletions(-)
313 326
321 A b.rename/b 334 A b.rename/b
322 b/b 335 b/b
323 A c.copy 336 A c.copy
324 c 337 c
325 R b/b 338 R b/b
339 R d
326 340
327 ensure old shelve backups are being deleted automatically 341 ensure old shelve backups are being deleted automatically
328 342
329 $ ls .hg/shelve-backup/ 343 $ ls .hg/shelve-backup/
330 default-01.hg 344 default-01.hg
361 $ hg status -v 375 $ hg status -v
362 M a/a 376 M a/a
363 M b.rename/b 377 M b.rename/b
364 M c.copy 378 M c.copy
365 R b/b 379 R b/b
380 R d
366 ? a/a.orig 381 ? a/a.orig
367 # The repository is in an unfinished *unshelve* state. 382 # The repository is in an unfinished *unshelve* state.
368 383
369 # Unresolved merge conflicts: 384 # Unresolved merge conflicts:
370 # 385 #
379 ensure that we have a merge with unresolved conflicts 394 ensure that we have a merge with unresolved conflicts
380 395
381 #if phasebased 396 #if phasebased
382 $ hg heads -q --template '{rev}\n' 397 $ hg heads -q --template '{rev}\n'
383 8 398 8
384 5 399 6
385 $ hg parents -q --template '{rev}\n' 400 $ hg parents -q --template '{rev}\n'
386 8 401 8
387 5 402 6
388 #endif 403 #endif
389 404
390 #if stripbased 405 #if stripbased
391 $ hg heads -q --template '{rev}\n' 406 $ hg heads -q --template '{rev}\n'
392 5 407 5
399 $ hg status 414 $ hg status
400 M a/a 415 M a/a
401 M b.rename/b 416 M b.rename/b
402 M c.copy 417 M c.copy
403 R b/b 418 R b/b
419 R d
404 ? a/a.orig 420 ? a/a.orig
405 $ hg diff 421 $ hg diff
406 diff --git a/a/a b/a/a 422 diff --git a/a/a b/a/a
407 --- a/a/a 423 --- a/a/a
408 +++ b/a/a 424 +++ b/a/a
410 a 426 a
411 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit 427 +<<<<<<< shelve: 2377350b6337 - shelve: pending changes temporary commit
412 c 428 c
413 +======= 429 +=======
414 +a 430 +a
415 +>>>>>>> working-copy: a68ec3400638 - shelve: changes to: [mq]: second.patch 431 +>>>>>>> working-copy: 203c9f771d2b - shelve: changes to: [mq]: second.patch
416 diff --git a/b/b b/b.rename/b 432 diff --git a/b/b b/b.rename/b
417 rename from b/b 433 rename from b/b
418 rename to b.rename/b 434 rename to b.rename/b
419 diff --git a/c b/c.copy 435 diff --git a/c b/c.copy
420 copy from c 436 copy from c
421 copy to c.copy 437 copy to c.copy
438 diff --git a/d b/d
439 deleted file mode 100644
440 --- a/d
441 +++ /dev/null
442 @@ -1,1 +0,0 @@
443 -d
422 $ hg resolve -l 444 $ hg resolve -l
423 U a/a 445 U a/a
424 446
425 $ hg shelve 447 $ hg shelve
426 abort: unshelve already in progress 448 abort: unshelve already in progress
432 $ hg status 454 $ hg status
433 M a/a 455 M a/a
434 M b.rename/b 456 M b.rename/b
435 M c.copy 457 M c.copy
436 R b/b 458 R b/b
459 R d
437 ? a/a.orig 460 ? a/a.orig
438 $ hg unshelve -a 461 $ hg unshelve -a
439 unshelve of 'default' aborted 462 unshelve of 'default' aborted
440 $ hg heads -q 463 $ hg heads -q
441 [37]:2e69b451d1ea (re) 464 [37]:2e69b451d1ea (re)
510 b/b 533 b/b
511 A c.copy 534 A c.copy
512 c 535 c
513 A foo/foo 536 A foo/foo
514 R b/b 537 R b/b
538 R d
515 ? a/a.orig 539 ? a/a.orig
516 540
517 there should be no shelves left 541 there should be no shelves left
518 542
519 $ hg shelve -l 543 $ hg shelve -l