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

Patrick Mézard pmezard at gmail.com
Sat Nov 1 11:20:56 CDT 2008


Petr Kodl a écrit :
> how about this - sorry for late entry
> 
> diff -r c4461ea8b4c8 mercurial/util.py
> --- a/mercurial/util.py    Sun Oct 26 17:26:28 2008 +0100
> +++ b/mercurial/util.py    Sat Nov 01 12:01:55 2008 -0400
> @@ -856,7 +856,7 @@
>          if pos == -1:
>              dir, base = '.', nf
>          else:
> -            dir, base = nf[:pos], nf[pos+1:]
> +            dir, base = nf[:pos+1], nf[pos+1:]
>          cache = dircache.get(dir, None)
>          if cache is None:
>              try:
> @@ -874,7 +874,7 @@
>              cache = dircache.setdefault(dir, dmap)
>          yield cache.get(base, None)
> 

Actually we stopped CC:ing -devel, my latest version is almost like yours. Python listdir() does not like directories like '//' very much. Any comments ?

diff --git a/mercurial/osutil.py b/mercurial/osutil.py
--- a/mercurial/osutil.py
+++ b/mercurial/osutil.py
@@ -26,7 +26,9 @@
       (name, type)
     '''
     result = []
-    prefix = path + os.sep
+    prefix = path
+    if not prefix.endswith(os.sep):
+        prefix += os.sep
     names = os.listdir(path)
     names.sort()
     for fn in names:
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -856,7 +856,7 @@
         if pos == -1:
             dir, base = '.', nf
         else:
-            dir, base = nf[:pos], nf[pos+1:]
+            dir, base = nf[:pos+1], nf[pos+1:]
         cache = dircache.get(dir, None)
         if cache is None:
             try:

--
Patrick Mézard


More information about the Mercurial-devel mailing list