tests: make (glob) on windows accept \ instead of / stable
authorMads Kiilerich <mads@kiilerich.com>
Mon, 07 Nov 2011 03:25:10 +0100
branchstable
changeset 1015 0a583943b4b4
parent 1014 58b7f58ae08c
child 1016 b4ca7adb4bf1
tests: make (glob) on windows accept \ instead of / Globbing is usually used for filenames, so on windows it is reasonable and very convenient that glob patterns accepts '\' or '/' when the pattern specifies '/'. [ original upstream message ]
tests/run-tests.py
tests/test-keyword.t
--- a/tests/run-tests.py	Mon Nov 07 03:24:53 2011 +0100
+++ b/tests/run-tests.py	Mon Nov 07 03:25:10 2011 +0100
@@ -530,20 +530,22 @@
         return False
 
 def globmatch(el, l):
-    # The only supported special characters are * and ?. Escaping is
-    # supported.
+    # The only supported special characters are * and ? plus / which also
+    # matches \ on windows. Escaping of these caracters is supported.
     i, n = 0, len(el)
     res = ''
     while i < n:
         c = el[i]
         i += 1
-        if c == '\\' and el[i] in '*?\\':
+        if c == '\\' and el[i] in '*?\\/':
             res += el[i - 1:i + 1]
             i += 1
         elif c == '*':
             res += '.*'
         elif c == '?':
             res += '.'
+        elif c == '/' and os.name == 'nt':
+            res += '[/\\\\]'
         else:
             res += re.escape(c)
     return rematch(res, l)
--- a/tests/test-keyword.t	Mon Nov 07 03:24:53 2011 +0100
+++ b/tests/test-keyword.t	Mon Nov 07 03:25:10 2011 +0100
@@ -210,7 +210,7 @@
   Message-Id: <hg.a2392c293916*> (glob)
   To: Test
   
-  changeset a2392c293916 in $TESTTMP/Test
+  changeset a2392c293916 in $TESTTMP/Test (glob)
   details: $TESTTMP/Test?cmd=changeset;node=a2392c293916
   description:
   	addsym
@@ -233,7 +233,7 @@
   Message-Id: <hg.ef63ca68695b*> (glob)
   To: Test
   
-  changeset ef63ca68695b in $TESTTMP/Test
+  changeset ef63ca68695b in $TESTTMP/Test (glob)
   details: $TESTTMP/Test?cmd=changeset;node=ef63ca68695b
   description:
   	absym
@@ -799,7 +799,7 @@
   > default = ../Test
   > EOF
   $ hg incoming
-  comparing with $TESTTMP/Test
+  comparing with $TESTTMP/Test (glob)
   searching for changes
   changeset:   2:bb948857c743
   tag:         tip