comparison hgext/shelve.py @ 20958:df33c9014430

shelve: repo['.'] is not a wctx but a pctx Don't confuse hackers!
author Mads Kiilerich <madski@unity3d.com>
date Mon, 07 Apr 2014 23:10:20 +0200
parents 3737e653dcbe
children 8e5b21ce8ee9
comparison
equal deleted inserted replaced
20956:dbf0fa39a5b8 20958:df33c9014430
524 wlock = repo.wlock() 524 wlock = repo.wlock()
525 525
526 tr = repo.transaction('unshelve', report=lambda x: None) 526 tr = repo.transaction('unshelve', report=lambda x: None)
527 oldtiprev = len(repo) 527 oldtiprev = len(repo)
528 528
529 wctx = repo['.'] 529 pctx = repo['.']
530 tmpwctx = wctx 530 tmpwctx = pctx
531 # The goal is to have a commit structure like so: 531 # The goal is to have a commit structure like so:
532 # ...-> wctx -> tmpwctx -> shelvectx 532 # ...-> pctx -> tmpwctx -> shelvectx
533 # where tmpwctx is an optional commit with the user's pending changes 533 # where tmpwctx is an optional commit with the user's pending changes
534 # and shelvectx is the unshelved changes. Then we merge it all down 534 # and shelvectx is the unshelved changes. Then we merge it all down
535 # to the original wctx. 535 # to the original pctx.
536 536
537 # Store pending changes in a commit 537 # Store pending changes in a commit
538 m, a, r, d = repo.status()[:4] 538 m, a, r, d = repo.status()[:4]
539 if m or a or r or d: 539 if m or a or r or d:
540 ui.status(_("temporarily committing pending changes " 540 ui.status(_("temporarily committing pending changes "
585 except error.InterventionRequired: 585 except error.InterventionRequired:
586 tr.close() 586 tr.close()
587 587
588 stripnodes = [repo.changelog.node(rev) 588 stripnodes = [repo.changelog.node(rev)
589 for rev in xrange(oldtiprev, len(repo))] 589 for rev in xrange(oldtiprev, len(repo))]
590 shelvedstate.save(repo, basename, wctx, tmpwctx, stripnodes) 590 shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes)
591 591
592 util.rename(repo.join('rebasestate'), 592 util.rename(repo.join('rebasestate'),
593 repo.join('unshelverebasestate')) 593 repo.join('unshelverebasestate'))
594 raise error.InterventionRequired( 594 raise error.InterventionRequired(
595 _("unresolved conflicts (see 'hg resolve', then " 595 _("unresolved conflicts (see 'hg resolve', then "
600 600
601 if not shelvectx in tmpwctx.children(): 601 if not shelvectx in tmpwctx.children():
602 # rebase was a no-op, so it produced no child commit 602 # rebase was a no-op, so it produced no child commit
603 shelvectx = tmpwctx 603 shelvectx = tmpwctx
604 604
605 mergefiles(ui, repo, wctx, shelvectx) 605 mergefiles(ui, repo, pctx, shelvectx)
606 shelvedstate.clear(repo) 606 shelvedstate.clear(repo)
607 607
608 # The transaction aborting will strip all the commits for us, 608 # The transaction aborting will strip all the commits for us,
609 # but it doesn't update the inmemory structures, so addchangegroup 609 # but it doesn't update the inmemory structures, so addchangegroup
610 # hooks still fire and try to operate on the missing commits. 610 # hooks still fire and try to operate on the missing commits.