mercurial/util.py
changeset 21046 cc13addbd62b
parent 21018 c848bfd02366
child 21813 c2262004c2e2
equal deleted inserted replaced
21045:7f875ed19475 21046:cc13addbd62b
  1994     def add(self, source, hook):
  1994     def add(self, source, hook):
  1995         self._hooks.append((source, hook))
  1995         self._hooks.append((source, hook))
  1996 
  1996 
  1997     def __call__(self, *args):
  1997     def __call__(self, *args):
  1998         self._hooks.sort(key=lambda x: x[0])
  1998         self._hooks.sort(key=lambda x: x[0])
       
  1999         results = []
  1999         for source, hook in self._hooks:
  2000         for source, hook in self._hooks:
  2000             hook(*args)
  2001             results.append(hook(*args))
       
  2002         return results
  2001 
  2003 
  2002 def debugstacktrace(msg='stacktrace', skip=0, f=sys.stderr, otherf=sys.stdout):
  2004 def debugstacktrace(msg='stacktrace', skip=0, f=sys.stderr, otherf=sys.stdout):
  2003     '''Writes a message to f (stderr) with a nicely formatted stacktrace.
  2005     '''Writes a message to f (stderr) with a nicely formatted stacktrace.
  2004     Skips the 'skip' last entries. By default it will flush stdout first.
  2006     Skips the 'skip' last entries. By default it will flush stdout first.
  2005     It can be used everywhere and do intentionally not require an ui object.
  2007     It can be used everywhere and do intentionally not require an ui object.