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

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Mar 5 06:12:10 CST 2014


# HG changeset patch
# User FUJIWARA Katsunori <foozy at 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

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.


More information about the Mercurial-devel mailing list