mercurial/hook.py
changeset 32642 c032e137e494
parent 32614 4b426ae96ff2
child 32897 799db2af824c
equal deleted inserted replaced
32641:49e1e5acb8ff 32642:c032e137e494
    11 import sys
    11 import sys
    12 
    12 
    13 from .i18n import _
    13 from .i18n import _
    14 from . import (
    14 from . import (
    15     demandimport,
    15     demandimport,
       
    16     encoding,
    16     error,
    17     error,
    17     extensions,
    18     extensions,
    18     pycompat,
    19     pycompat,
    19     util,
    20     util,
    20 )
    21 )
    95         if isinstance(exc, error.Abort):
    96         if isinstance(exc, error.Abort):
    96             ui.warn(_('error: %s hook failed: %s\n') %
    97             ui.warn(_('error: %s hook failed: %s\n') %
    97                          (hname, exc.args[0]))
    98                          (hname, exc.args[0]))
    98         else:
    99         else:
    99             ui.warn(_('error: %s hook raised an exception: '
   100             ui.warn(_('error: %s hook raised an exception: '
   100                            '%s\n') % (hname, exc))
   101                       '%s\n') % (hname, encoding.strtolocal(str(exc))))
   101         if throw:
   102         if throw:
   102             raise
   103             raise
   103         if not ui.tracebackflag:
   104         if not ui.tracebackflag:
   104             ui.warn(_('(run with --traceback for stack trace)\n'))
   105             ui.warn(_('(run with --traceback for stack trace)\n'))
   105         ui.traceback()
   106         ui.traceback()