mercurial/hook.py
changeset 18691 4f485bd68f1d
parent 18671 1c305128e5b9
child 20422 aac87f70f38e
equal deleted inserted replaced
18690:4c6f7f0dadab 18691:4f485bd68f1d
    96         sys.stdout, sys.stderr, sys.stdin = old
    96         sys.stdout, sys.stderr, sys.stdin = old
    97         duration = time.time() - starttime
    97         duration = time.time() - starttime
    98         readablefunc = funcname
    98         readablefunc = funcname
    99         if isinstance(funcname, types.FunctionType):
    99         if isinstance(funcname, types.FunctionType):
   100             readablefunc = funcname.__module__ + "." + funcname.__name__
   100             readablefunc = funcname.__module__ + "." + funcname.__name__
   101         ui.log('pythonhook', _('pythonhook-%s: %s finished in %0.2f seconds\n'),
   101         ui.log('pythonhook', 'pythonhook-%s: %s finished in %0.2f seconds\n',
   102                name, readablefunc, duration)
   102                name, readablefunc, duration)
   103     if r:
   103     if r:
   104         if throw:
   104         if throw:
   105             raise util.Abort(_('%s hook failed') % hname)
   105             raise util.Abort(_('%s hook failed') % hname)
   106         ui.warn(_('warning: %s hook failed\n') % hname)
   106         ui.warn(_('warning: %s hook failed\n') % hname)
   130         r = util.system(cmd, environ=env, cwd=cwd, out=ui)
   130         r = util.system(cmd, environ=env, cwd=cwd, out=ui)
   131     else:
   131     else:
   132         r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout)
   132         r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout)
   133 
   133 
   134     duration = time.time() - starttime
   134     duration = time.time() - starttime
   135     ui.log('exthook', _('exthook-%s: %s finished in %0.2f seconds\n'),
   135     ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n',
   136            name, cmd, duration)
   136            name, cmd, duration)
   137     if r:
   137     if r:
   138         desc, r = util.explainexit(r)
   138         desc, r = util.explainexit(r)
   139         if throw:
   139         if throw:
   140             raise util.Abort(_('%s hook %s') % (name, desc))
   140             raise util.Abort(_('%s hook %s') % (name, desc))