[PATCH 1 of 2 STABLE] ui: add a variable to control whether hooks should be called
Idan Kamara
idankk86 at gmail.com
Sat Jun 23 11:57:59 CDT 2012
# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1340470627 -10800
# Branch stable
# Node ID 26afc4b68fb967ade439d529ac6296faa7cb19c7
# Parent f8af57c00a29cb52c7561fad1f7ab2d9e68b96cf
ui: add a variable to control whether hooks should be called
So hooks can be temporarily disabled.
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -138,6 +138,9 @@
_redirect = state
def hook(ui, repo, name, throw=False, **args):
+ if not ui.callhooks:
+ return False
+
r = False
oldstdout = -1
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -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
More information about the Mercurial-devel
mailing list