changeset 1980:3c4a20244771

destination: use the correct abort class for error These errors have been in Mercurial long enough. Having them will make the coming changesets simpler.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sun, 14 Aug 2016 23:17:09 +0200
parents bee7a1ef8ba8
children b467fe430404
files hgext3rd/topic/destination.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/destination.py	Sun Aug 14 19:40:53 2016 +0200
+++ b/hgext3rd/topic/destination.py	Sun Aug 14 23:17:09 2016 +0200
@@ -22,14 +22,15 @@
             # should look at all branch involved but... later
             bhead = ngtip(repo, p1.branch(), all=True)
             if not bhead:
-                raise error.Abort(_("nothing to merge"))
+                raise error.NoMergeDestAbort(_("nothing to merge"))
             elif 1 == len(bhead):
                 return bhead.first()
             else:
-                raise error.Abort(_("branch '%s' has %d heads - "
-                                    "please merge with an explicit rev")
-                                  % (p1.branch(), len(bhead)),
-                                  hint=_("run 'hg heads .' to see heads"))
+                msg = _("branch '%s' has %d heads "
+                        "- please merge with an explicit rev")
+                hint = _("run 'hg heads .' to see heads")
+                raise error.ManyMergeDestAbort(msg % (p1.branch(), len(bhead)),
+                                               hint=hint)
         elif 2 == len(heads):
             heads = [r for r in heads if r != p1.rev()]
             # XXX: bla bla bla bla bla
@@ -39,9 +40,9 @@
                                          "explicit revision"))
             return heads[0]
         elif 2 < len(heads):
-            raise error.Abort(_("topic '%s' has %d heads - "
-                                "please merge with an explicit rev")
-                              % (top, len(heads)))
+            msg = _("topic '%s' has %d heads "
+                    "- please merge with an explicit rev") % (top, len(heads))
+            raise error.ManyMergeDestAbort(msg)
         else:
             assert False # that's impossible
     if len(getattr(orig, 'func_defaults', ())) == 3: # version hg-3.7