[PATCH 1 of 2 stable] keyword: do not monkeypatch diff when in restricted mode

Christian Ebert blacktrash at gmx.net
Wed Dec 23 06:05:58 CST 2009


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1261569844 0
# Node ID e0b38b9dcebbf564ab5fda50db0cc8c0cfbd0ac6
# Parent  57949bfec718c467f02bd4e9c2bfb8e24d001a5b
keyword: do not monkeypatch diff when in restricted mode

kw_diff actually disabled restricted mode when 2 revisions were given,
because it effectively disables the extension in this case.

But the commands working with diff and patch need restricted mode
always enabled, i.e. expansion enabled when writing to the
working directory and - crucial for these commands - no expansion
when reading the filelog.

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -535,7 +535,8 @@
     repo.__class__ = kwrepo
 
     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
-    extensions.wrapfunction(patch, 'diff', kw_diff)
+    if not kwt.restrict:
+        extensions.wrapfunction(patch, 'diff', kw_diff)
     for c in 'annotate changeset rev filediff diff'.split():
         extensions.wrapfunction(webcommands, c, kwweb_skip)
 


More information about the Mercurial-devel mailing list