comparison hgext/shelve.py @ 31312:7eb53603744b

vfs: use repo.vfs.rename
author Mads Kiilerich <mads@kiilerich.com>
date Sat, 11 Mar 2017 11:04:14 -0800
parents f59b6cf663a9
children 3acc7af5859c
comparison
equal deleted inserted replaced
31311:f59b6cf663a9 31312:7eb53603744b
549 """subcommand that abort an in-progress unshelve""" 549 """subcommand that abort an in-progress unshelve"""
550 with repo.lock(): 550 with repo.lock():
551 try: 551 try:
552 checkparents(repo, state) 552 checkparents(repo, state)
553 553
554 util.rename(repo.join('unshelverebasestate'), 554 repo.vfs.rename('unshelverebasestate', 'rebasestate')
555 repo.join('rebasestate'))
556 try: 555 try:
557 rebase.rebase(ui, repo, **{ 556 rebase.rebase(ui, repo, **{
558 'abort' : True 557 'abort' : True
559 }) 558 })
560 except Exception: 559 except Exception:
561 util.rename(repo.join('rebasestate'), 560 repo.vfs.rename('rebasestate', 'unshelverebasestate')
562 repo.join('unshelverebasestate'))
563 raise 561 raise
564 562
565 mergefiles(ui, repo, state.wctx, state.pendingctx) 563 mergefiles(ui, repo, state.wctx, state.pendingctx)
566 repair.strip(ui, repo, state.stripnodes, backup=False, 564 repair.strip(ui, repo, state.stripnodes, backup=False,
567 topic='shelve') 565 topic='shelve')
617 if [f for f in ms if ms[f] == 'u']: 615 if [f for f in ms if ms[f] == 'u']:
618 raise error.Abort( 616 raise error.Abort(
619 _("unresolved conflicts, can't continue"), 617 _("unresolved conflicts, can't continue"),
620 hint=_("see 'hg resolve', then 'hg unshelve --continue'")) 618 hint=_("see 'hg resolve', then 'hg unshelve --continue'"))
621 619
622 util.rename(repo.join('unshelverebasestate'), 620 repo.vfs.rename('unshelverebasestate', 'rebasestate')
623 repo.join('rebasestate'))
624 try: 621 try:
625 rebase.rebase(ui, repo, **{ 622 rebase.rebase(ui, repo, **{
626 'continue' : True 623 'continue' : True
627 }) 624 })
628 except Exception: 625 except Exception:
629 util.rename(repo.join('rebasestate'), 626 repo.vfs.rename('rebasestate', 'unshelverebasestate')
630 repo.join('unshelverebasestate'))
631 raise 627 raise
632 628
633 shelvectx = repo['tip'] 629 shelvectx = repo['tip']
634 if not shelvectx in state.pendingctx.children(): 630 if not shelvectx in state.pendingctx.children():
635 # rebase was a no-op, so it produced no child commit 631 # rebase was a no-op, so it produced no child commit
696 stripnodes = [repo.changelog.node(rev) 692 stripnodes = [repo.changelog.node(rev)
697 for rev in xrange(oldtiprev, len(repo))] 693 for rev in xrange(oldtiprev, len(repo))]
698 shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes, 694 shelvedstate.save(repo, basename, pctx, tmpwctx, stripnodes,
699 branchtorestore, opts.get('keep')) 695 branchtorestore, opts.get('keep'))
700 696
701 util.rename(repo.join('rebasestate'), 697 repo.vfs.rename('rebasestate', 'unshelverebasestate')
702 repo.join('unshelverebasestate'))
703 raise error.InterventionRequired( 698 raise error.InterventionRequired(
704 _("unresolved conflicts (see 'hg resolve', then " 699 _("unresolved conflicts (see 'hg resolve', then "
705 "'hg unshelve --continue')")) 700 "'hg unshelve --continue')"))
706 701
707 # refresh ctx after rebase completes 702 # refresh ctx after rebase completes