diff mercurial/discovery.py @ 46119:9261f6c1d39b

errors: raise StateError when push fails because it creates new heads I decided to raise `StateError` here because the local and remote repos are in an incompatible state. I think remote errors (exit code 100) should be when something goes wrong on the remote and there's nothing the user can do. Differential Revision: https://phab.mercurial-scm.org/D9391
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 23 Nov 2020 16:39:53 -0800
parents 89a2afe31e82
children 6266d19556ad
line wrap: on
line diff
--- a/mercurial/discovery.py	Mon Nov 23 10:38:05 2020 -0800
+++ b/mercurial/discovery.py	Mon Nov 23 16:39:53 2020 -0800
@@ -362,7 +362,7 @@
 def checkheads(pushop):
     """Check that a push won't add any outgoing head
 
-    raise Abort error and display ui message as needed.
+    raise StateError error and display ui message as needed.
     """
 
     repo = pushop.repo.unfiltered()
@@ -409,7 +409,7 @@
         else:
             errmsg = _(b"push creates new remote branches: %s") % branchnames
         hint = _(b"use 'hg push --new-branch' to create new remote branches")
-        raise error.Abort(errmsg, hint=hint)
+        raise error.StateError(errmsg, hint=hint)
 
     # 2. Find heads that we need not warn about
     nowarnheads = _nowarnheads(pushop)
@@ -505,7 +505,7 @@
             for h in dhs:
                 repo.ui.note(b" %s\n" % short(h))
     if errormsg:
-        raise error.Abort(errormsg, hint=hint)
+        raise error.StateError(errormsg, hint=hint)
 
 
 def _postprocessobsolete(pushop, futurecommon, candidate_newhs):