[PATCH] Fix util._statfiles_clustered() failing at root of a windows drive

Patrick Mézard pmezard at gmail.com
Sat Nov 1 10:14:55 CDT 2008


Patrick Mézard a écrit :
> Any objection about the following instead ? Why aren't we keeping the trailing os.sep in dir, I don't know.

Keeping the trailing os.sep does not seem problematic, what about this one instead:

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -849,6 +849,7 @@
     lstat = os.lstat
     ncase = os.path.normcase
     sep   = os.sep
+    rootpath = None
     dircache = {} # dirname -> filename -> status | None if file does not exist
     for nf in files:
         nf  = ncase(nf)
@@ -856,7 +857,11 @@
         if pos == -1:
             dir, base = '.', nf
         else:
-            dir, base = nf[:pos], nf[pos+1:]
+            dir, base = nf[:pos+1], nf[pos+1:]
+            if dir == sep:
+                if rootpath is None:
+                    rootpath = os.path.abspath(sep)
+                dir = rootpath
         cache = dircache.get(dir, None)
         if cache is None:
             try:



More information about the Mercurial-devel mailing list