comparison hgext/transplant.py @ 45840:527ce85c2e60

errors: introduce StateError and use it from commands and cmdutil This very similar to an earlier patch (which was for `InputError`). In this patch, I also updated the transplant extension only because `test-transplant.t` would otherwise have needed a `#if continueflag`. Differential Revision: https://phab.mercurial-scm.org/D9310
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 12 Oct 2020 12:44:18 -0700
parents c1b603cdc95a
children 89a2afe31e82
comparison
equal deleted inserted replaced
45839:ebee234d952a 45840:527ce85c2e60
802 p1 = repo.dirstate.p1() 802 p1 = repo.dirstate.p1()
803 if len(repo) > 0 and p1 == revlog.nullid: 803 if len(repo) > 0 and p1 == revlog.nullid:
804 raise error.Abort(_(b'no revision checked out')) 804 raise error.Abort(_(b'no revision checked out'))
805 if opts.get(b'continue'): 805 if opts.get(b'continue'):
806 if not tp.canresume(): 806 if not tp.canresume():
807 raise error.Abort(_(b'no transplant to continue')) 807 raise error.StateError(_(b'no transplant to continue'))
808 elif opts.get(b'stop'): 808 elif opts.get(b'stop'):
809 if not tp.canresume(): 809 if not tp.canresume():
810 raise error.Abort(_(b'no interrupted transplant found')) 810 raise error.StateError(_(b'no interrupted transplant found'))
811 return tp.stop(ui, repo) 811 return tp.stop(ui, repo)
812 else: 812 else:
813 cmdutil.checkunfinished(repo) 813 cmdutil.checkunfinished(repo)
814 cmdutil.bailifchanged(repo) 814 cmdutil.bailifchanged(repo)
815 815