mercurial/localrepo.py
changeset 2581 54b152379589
parent 2578 cf4f0322851d
child 2601 00fc88b0b256
equal deleted inserted replaced
2580:a20a1bb0c396 2581:54b152379589
    99                                  % (hname, funcname))
    99                                  % (hname, funcname))
   100             modname = funcname[:d]
   100             modname = funcname[:d]
   101             try:
   101             try:
   102                 obj = __import__(modname)
   102                 obj = __import__(modname)
   103             except ImportError:
   103             except ImportError:
   104                 raise util.Abort(_('%s hook is invalid '
   104                 try:
   105                                    '(import of "%s" failed)') %
   105                     # extensions are loaded with hgext_ prefix
   106                                  (hname, modname))
   106                     obj = __import__("hgext_%s" % modname)
       
   107                 except ImportError:
       
   108                     raise util.Abort(_('%s hook is invalid '
       
   109                                        '(import of "%s" failed)') %
       
   110                                      (hname, modname))
   107             try:
   111             try:
   108                 for p in funcname.split('.')[1:]:
   112                 for p in funcname.split('.')[1:]:
   109                     obj = getattr(obj, p)
   113                     obj = getattr(obj, p)
   110             except AttributeError, err:
   114             except AttributeError, err:
   111                 raise util.Abort(_('%s hook is invalid '
   115                 raise util.Abort(_('%s hook is invalid '