[PATCH] Fix util._statfiles_clustered() failing at root of a windows drive
Petr Kodl
petrkodl at gmail.com
Sat Nov 1 11:06:19 CDT 2008
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)
This leaves the trailing \ in dir so m:\ stays m:\ instead of becoming m:
osutil.c can handle the trailing slash just fine - it turns it into \*.*
and this behavior is consistent in native Python os.listdir
I tested both root and non-root repos and it works fine
pk
Patrick Mézard wrote:
> 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:
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
More information about the Mercurial-devel
mailing list