[PATCH] Make it possible to disable filtering for a pattern

Mads Kiilerich mads at kiilerich.com
Tue Oct 14 14:29:05 CDT 2008


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1224012529 -7200
# Node ID 1ba8702efa74c2a86034a4a9b5ef8783f9735cc2
# Parent  4e1bd3d919018096a644c4e821531d80898b755b
Make it possible to disable filtering for a pattern.

Rationale: Apparently there were no way to disable for example win32text extension locally.

RFC: Can it already be done another way?

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -501,6 +501,8 @@
         if filter not in self.filterpats:
             l = []
             for pat, cmd in self.ui.configitems(filter):
+                if cmd == '!':
+                    continue
                 mf = util.matcher(self.root, "", [pat], [], [])[1]
                 fn = None
                 params = cmd
diff --git a/tests/test-win32text b/tests/test-win32text
--- a/tests/test-win32text
+++ b/tests/test-win32text
@@ -113,3 +113,19 @@
 hg revert -a
 hg st -q
 python print.py < linefeed
+
+echo "# disable extension again"
+echo '[decode]' >> .hg/hgrc
+echo '** = !' >> .hg/hgrc
+echo '[encode]' >> .hg/hgrc
+echo '** = !' >> .hg/hgrc
+cat .hg/hgrc
+echo
+
+rm f3 f4.bat bin
+hg co 2>&1 | python -c 'import sys, os; sys.stdout.write(sys.stdin.read().replace(os.getcwd(), "...."))'
+python print.py < bin
+python print.py < f3
+python print.py < f4.bat
+echo
+
diff --git a/tests/test-win32text.out b/tests/test-win32text.out
--- a/tests/test-win32text.out
+++ b/tests/test-win32text.out
@@ -185,3 +185,20 @@
 M linefeed
 reverting linefeed
 % just linefeed<CR><LF>
+# disable extension again
+[extensions]
+win32text = 
+[decode]
+** = cleverdecode:
+[encode]
+** = cleverencode:
+[decode]
+** = !
+[encode]
+** = !
+
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+hello<NUL><CR><LF>
+some<LF>text<LF>
+rem empty<LF>
+


More information about the Mercurial-devel mailing list