diff mercurial/rewriteutil.py @ 45853:b4694ef45db5

errors: raise more specific errors from rewriteutil Differential Revision: https://phab.mercurial-scm.org/D9330
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 16 Nov 2020 15:11:51 -0800
parents 3d68b47e461b
children 59fa3890d40a
line wrap: on
line diff
--- a/mercurial/rewriteutil.py	Tue Nov 17 19:29:08 2020 +0900
+++ b/mercurial/rewriteutil.py	Mon Nov 16 15:11:51 2020 -0800
@@ -33,20 +33,20 @@
     if node.nullrev in revs:
         msg = _(b"cannot %s null changeset") % action
         hint = _(b"no changeset checked out")
-        raise error.Abort(msg, hint=hint)
+        raise error.InputError(msg, hint=hint)
 
     if len(repo[None].parents()) > 1:
-        raise error.Abort(_(b"cannot %s while merging") % action)
+        raise error.StateError(_(b"cannot %s while merging") % action)
 
     publicrevs = repo.revs(b'%ld and public()', revs)
     if publicrevs:
         msg = _(b"cannot %s public changesets") % action
         hint = _(b"see 'hg help phases' for details")
-        raise error.Abort(msg, hint=hint)
+        raise error.InputError(msg, hint=hint)
 
     newunstable = disallowednewunstable(repo, revs)
     if newunstable:
-        raise error.Abort(_(b"cannot %s changeset with children") % action)
+        raise error.InputError(_(b"cannot %s changeset with children") % action)
 
 
 def disallowednewunstable(repo, revs):