Make it possible to disable filtering for a pattern.
authorMads Kiilerich <mads@kiilerich.com>
Tue, 14 Oct 2008 21:28:49 +0200
changeset 7226 b71a52f101dc
parent 7225 59b4ae211584
child 7227 e1afb50ec2aa
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?
mercurial/localrepo.py
tests/test-win32text
tests/test-win32text.out
--- a/mercurial/localrepo.py	Tue Oct 21 17:47:49 2008 +0200
+++ b/mercurial/localrepo.py	Tue Oct 14 21:28:49 2008 +0200
@@ -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
--- a/tests/test-win32text	Tue Oct 21 17:47:49 2008 +0200
+++ b/tests/test-win32text	Tue Oct 14 21:28:49 2008 +0200
@@ -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
+
--- a/tests/test-win32text.out	Tue Oct 21 17:47:49 2008 +0200
+++ b/tests/test-win32text.out	Tue Oct 14 21:28:49 2008 +0200
@@ -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>
+