changeset 28079:0c9e914029be

hook: fewer parentheses for hook load errors This matches 'hook failed' warnings. We're also going to add hints to some of the hook load errors. Without this change we'd have two pairs of parens for a single error message, which looks really cluttered.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 11 Feb 2016 22:41:20 -0800
parents 2058e1a894f2
children 37b818cad146
files mercurial/hook.py tests/test-hook.t
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Thu Feb 11 22:02:52 2016 -0800
+++ b/mercurial/hook.py	Thu Feb 11 22:41:20 2016 -0800
@@ -65,7 +65,7 @@
                                   'attempt:\n'))
                     ui.traceback(e2)
                     raise error.HookLoadError(
-                        _('%s hook is invalid (import of "%s" failed)') %
+                        _('%s hook is invalid: import of "%s" failed') %
                         (hname, modname))
         sys.path = oldpaths
         try:
@@ -73,11 +73,11 @@
                 obj = getattr(obj, p)
         except AttributeError:
             raise error.HookLoadError(
-                _('%s hook is invalid ("%s" is not defined)')
+                _('%s hook is invalid: "%s" is not defined')
                 % (hname, funcname))
         if not callable(obj):
             raise error.HookLoadError(
-                _('%s hook is invalid ("%s" is not callable)')
+                _('%s hook is invalid: "%s" is not callable')
                 % (hname, funcname))
 
     ui.note(_("calling hook %s: %s\n") % (hname, funcname))
--- a/tests/test-hook.t	Thu Feb 11 22:02:52 2016 -0800
+++ b/tests/test-hook.t	Thu Feb 11 22:41:20 2016 -0800
@@ -480,7 +480,7 @@
   $ hg pull ../a
   pulling from ../a
   searching for changes
-  abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
+  abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable
   [255]
 
   $ echo '[hooks]' > ../a/.hg/hgrc
@@ -488,7 +488,7 @@
   $ hg pull ../a
   pulling from ../a
   searching for changes
-  abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
+  abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined
   [255]
 
   $ echo '[hooks]' > ../a/.hg/hgrc
@@ -504,7 +504,7 @@
   $ hg pull ../a
   pulling from ../a
   searching for changes
-  abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
+  abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed
   [255]
 
   $ echo '[hooks]' > ../a/.hg/hgrc
@@ -512,7 +512,7 @@
   $ hg pull ../a
   pulling from ../a
   searching for changes
-  abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
+  abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed
   [255]
 
   $ echo '[hooks]' > ../a/.hg/hgrc
@@ -628,8 +628,8 @@
   Traceback (most recent call last):
   ImportError: No module named hgext_importfail
   Traceback (most recent call last):
-  HookLoadError: precommit.importfail hook is invalid (import of "importfail" failed)
-  abort: precommit.importfail hook is invalid (import of "importfail" failed)
+  HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed
+  abort: precommit.importfail hook is invalid: import of "importfail" failed
 
 Issue1827: Hooks Update & Commit not completely post operation