Patchwork [05,of,12,V2] util: enable "hooks" to return list of the values returned from each hooks

login
register
mail settings
Submitter Katsunori FUJIWARA
Date April 15, 2014, 3:52 p.m.
Message ID <8b4ee4203f00b80ed8fb.1397577146@juju>
Download mbox | patch
Permalink /patch/4361/
State Accepted
Commit cc13addbd62bb4fb6a1b295a85d99e95a46c5dfd
Headers show

Comments

Katsunori FUJIWARA - April 15, 2014, 3:52 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1397576244 -32400
#      Wed Apr 16 00:37:24 2014 +0900
# Node ID 8b4ee4203f00b80ed8fb2d07886d296ca8010008
# Parent  162bfdc3ba21fd9fade4c997e4ad0ca6fc7e3a1e
util: enable "hooks" to return list of the values returned from each hooks

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1996,8 +1996,10 @@ 
 
     def __call__(self, *args):
         self._hooks.sort(key=lambda x: x[0])
+        results = []
         for source, hook in self._hooks:
-            hook(*args)
+            results.append(hook(*args))
+        return results
 
 def debugstacktrace(msg='stacktrace', skip=0, f=sys.stderr, otherf=sys.stdout):
     '''Writes a message to f (stderr) with a nicely formatted stacktrace.