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

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 5, 2014, 12:12 p.m.
Message ID <e925ae1a9764d3db6f93.1394021530@juju>
Download mbox | patch
Permalink /patch/3842/
State Superseded
Headers show

Comments

Katsunori FUJIWARA - March 5, 2014, 12:12 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1394019743 -32400
#      Wed Mar 05 20:42:23 2014 +0900
# Node ID e925ae1a9764d3db6f9385e349cc45cafd8fdd46
# Parent  4f6db8a3e6fde9810d0db5ec8714c46acd79e71f
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
@@ -1986,8 +1986,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.