[PATCH 0 of 8] Case folding fixes (issues 593, 750, 910, 1083 and 1092)

Patrick Mézard pmezard at gmail.com
Fri May 2 06:09:09 CDT 2008


Paul Moore a écrit :
> This series of patches fixes a number of case folding issues (593, 750, 910,
> 1083 and 1092) and introduces infrastructure which should make resolving
> future case folding issues easier.

Here is an hghave update to write tests on case-insensitive systems. We might want to separate case-preserving/normalizing/whatever later but it should be enough for now:

diff --git a/tests/hghave b/tests/hghave
--- a/tests/hghave
+++ b/tests/hghave
@@ -32,6 +32,25 @@
 
 def has_darcs():
     return matchoutput('darcs', r'darcs version', True)
+
+def has_icasefs():
+    def checkfolding(path):
+        s1 = os.stat(path)
+        d, b = os.path.split(path)
+        if b.upper() == b.lower():
+            raise Exception('cannot test filesystem case-insensitivity with'
+                            ' %s path' % b)
+        p2 = os.path.join(d, b.upper())
+        if path == p2:
+            p2 = os.path.join(d, b.lower())
+        try:
+            s2 = os.stat(p2)
+            return s2 != s1
+        except:
+            return True
+
+    path = os.path.abspath(os.getcwd())
+    return not checkfolding(path)
 
 def has_mtn():
     return matchoutput('mtn --version', r'monotone', True) and not matchoutput(
@@ -125,6 +144,7 @@
     "darcs": (has_darcs, "darcs client"),
     "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
     "execbit": (has_executablebit, "executable bit"),
+    "icasefs": (has_icasefs, "case-insensitive filesystem"),
     "fifo": (has_fifo, "named pipes"),
     "git": (has_git, "git command line client"),
     "hotshot": (has_hotshot, "python hotshot module"),




More information about the Mercurial-devel mailing list