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

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Tue Apr 15 10:52:26 CDT 2014


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

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.


More information about the Mercurial-devel mailing list