diff mercurial/dispatch.py @ 21572:6c9b7712ac69 stable

alias: change return code of bad definition to 255 We use 255 for general command error. It can't raise util.Abort because help module executes badalias command to get error message.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 May 2014 15:14:18 +0900
parents c5afb07c33d3
children 57c70d3ad1c9
line wrap: on
line diff
--- a/mercurial/dispatch.py	Tue May 27 15:16:52 2014 -0700
+++ b/mercurial/dispatch.py	Sat May 17 15:14:18 2014 +0900
@@ -355,7 +355,7 @@
         if not self.definition:
             def fn(ui, *args):
                 ui.warn(_("no definition for alias '%s'\n") % self.name)
-                return 1
+                return -1
             self.fn = fn
             self.badalias = True
             return
@@ -389,7 +389,7 @@
             def fn(ui, *args):
                 ui.warn(_("error in definition for alias '%s': %s\n")
                         % (self.name, inst))
-                return 1
+                return -1
             self.fn = fn
             self.badalias = True
             return
@@ -402,7 +402,7 @@
                     ui.warn(_("error in definition for alias '%s': %s may only "
                               "be given on the command line\n")
                             % (self.name, invalidarg))
-                    return 1
+                    return -1
 
                 self.fn = fn
                 self.badalias = True
@@ -434,14 +434,14 @@
                     commands.help_(ui, cmd, unknowncmd=True)
                 except error.UnknownCommand:
                     pass
-                return 1
+                return -1
             self.fn = fn
             self.badalias = True
         except error.AmbiguousCommand:
             def fn(ui, *args):
                 ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \
                             % (self.name, cmd))
-                return 1
+                return -1
             self.fn = fn
             self.badalias = True