[PATCH 17 of 19] run-tests: make $TESTTMP matching case-insensitive on windows

Mads Kiilerich mads at kiilerich.com
Sun Nov 6 20:41:07 CST 2011


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1320632710 -3600
# Node ID 24d9c40510ee000d4894a870c8f558210c1c643f
# Parent  3c4cd6af667f592640e5183b56690c6c92148aee
run-tests: make $TESTTMP matching case-insensitive on windows

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -867,13 +867,20 @@
         os.path.join(HGTMP, os.path.basename(test)).replace('\\', '/')
 
     replacements = [
-        (re.escape(testtmp), '$TESTTMP'),
         (r':%s\b' % options.port, ':$HGPORT'),
         (r':%s\b' % (options.port + 1), ':$HGPORT1'),
         (r':%s\b' % (options.port + 2), ':$HGPORT2'),
         ]
     if os.name == 'nt':
         replacements.append((r'\r\n', '\n'))
+        replacements.append(
+            (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
+                     c in '/\\' and r'[/\\]' or
+                     c.isdigit() and c or
+                     '\\' + c
+                     for c in testtmp), '$TESTTMP'))
+    else:
+        replacements.append((re.escape(testtmp), '$TESTTMP'))
 
     os.mkdir(testtmp)
     ret, out = runner(testpath, testtmp, options, replacements)


More information about the Mercurial-devel mailing list