allow use of extensions in python hooks
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sun, 09 Jul 2006 11:10:11 +0200
changeset 2581 54b152379589
parent 2580 a20a1bb0c396
child 2582 276de216d2c5
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
mercurial/localrepo.py
--- 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)