mercurial/hook.py
changeset 36108 c4146cf4dd20
parent 35357 056a9c8813aa
child 36841 9c636ec1ef37
equal deleted inserted replaced
36107:bff95b002e33 36108:c4146cf4dd20
    47             if modpath and modfile:
    47             if modpath and modfile:
    48                 sys.path = sys.path[:] + [modpath]
    48                 sys.path = sys.path[:] + [modpath]
    49                 modname = modfile
    49                 modname = modfile
    50         with demandimport.deactivated():
    50         with demandimport.deactivated():
    51             try:
    51             try:
    52                 obj = __import__(modname)
    52                 obj = __import__(pycompat.sysstr(modname))
    53             except (ImportError, SyntaxError):
    53             except (ImportError, SyntaxError):
    54                 e1 = sys.exc_info()
    54                 e1 = sys.exc_info()
    55                 try:
    55                 try:
    56                     # extensions are loaded with hgext_ prefix
    56                     # extensions are loaded with hgext_ prefix
    57                     obj = __import__("hgext_%s" % modname)
    57                     obj = __import__(r"hgext_%s" % pycompat.sysstr(modname))
    58                 except (ImportError, SyntaxError):
    58                 except (ImportError, SyntaxError):
    59                     e2 = sys.exc_info()
    59                     e2 = sys.exc_info()
    60                     if ui.tracebackflag:
    60                     if ui.tracebackflag:
    61                         ui.warn(_('exception from first failed import '
    61                         ui.warn(_('exception from first failed import '
    62                                   'attempt:\n'))
    62                                   'attempt:\n'))