changeset 17048:15d4d475de9e stable

ui: add a variable to control whether hooks should be called So hooks can be temporarily disabled.
author Idan Kamara <idankk86@gmail.com>
date Sat, 23 Jun 2012 19:57:07 +0300
parents d63fb1fce977
children 2440822446ce
files mercurial/hook.py mercurial/ui.py
diffstat 2 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hook.py	Thu Jun 28 18:39:16 2012 +0200
+++ b/mercurial/hook.py	Sat Jun 23 19:57:07 2012 +0300
@@ -138,6 +138,9 @@
     _redirect = state
 
 def hook(ui, repo, name, throw=False, **args):
+    if not ui.callhooks:
+        return False
+
     r = False
 
     oldstdout = -1
--- a/mercurial/ui.py	Thu Jun 28 18:39:16 2012 +0200
+++ b/mercurial/ui.py	Sat Jun 23 19:57:07 2012 +0300
@@ -19,6 +19,7 @@
         self._ucfg = config.config() # untrusted
         self._trustusers = set()
         self._trustgroups = set()
+        self.callhooks = True
 
         if src:
             self.fout = src.fout
@@ -31,6 +32,7 @@
             self._trustusers = src._trustusers.copy()
             self._trustgroups = src._trustgroups.copy()
             self.environ = src.environ
+            self.callhooks = src.callhooks
             self.fixconfig()
         else:
             self.fout = sys.stdout