changeset 2581:54b152379589

allow use of extensions in python hooks extensions are loaded with hgext_ prefix, try to use them if the module is not found in the normal path
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 09 Jul 2006 11:10:11 +0200
parents a20a1bb0c396
children 276de216d2c5
files mercurial/localrepo.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jun 29 15:16:25 2006 +0200
+++ b/mercurial/localrepo.py	Sun Jul 09 11:10:11 2006 +0200
@@ -101,9 +101,13 @@
             try:
                 obj = __import__(modname)
             except ImportError:
-                raise util.Abort(_('%s hook is invalid '
-                                   '(import of "%s" failed)') %
-                                 (hname, modname))
+                try:
+                    # extensions are loaded with hgext_ prefix
+                    obj = __import__("hgext_%s" % modname)
+                except ImportError:
+                    raise util.Abort(_('%s hook is invalid '
+                                       '(import of "%s" failed)') %
+                                     (hname, modname))
             try:
                 for p in funcname.split('.')[1:]:
                     obj = getattr(obj, p)