[PATCH 3 of 3] use per-directory clustered stat calls even in cases where known tree is walked

Benoit Boissinot bboissin at gmail.com
Mon Oct 6 05:45:07 CDT 2008


On Mon, Oct 6, 2008 at 12:36 PM, Christian Boos <cboos at neuf.fr> wrote:
> Nearly there, I ended up with a much reduced list of pseudo-deleted files,
> actually only those at the top-level.
> Tracking the problem down to:
>
>> diff --git a/mercurial/util.py b/mercurial/util.py
>> --- a/mercurial/util.py
>> +++ b/mercurial/util.py
>> @@ -1162,6 +1162,25 @@
>>         except NameError:
>>             pass
>>  +    def statfiles(files):
>> +        dircache = {}
>> +        for fn in files:
>> +            pos = fn.rfind('/')
>>
>
> Here we'd need to look for '\\' as well, otherwise if `fn` is something like
>  'C:\\something\\repo\\file' (which is what happens for top-level files),
> the `ls` dict will only contain the 'file' key and therefore stafiles will
> yield None in this case.
>
> i.e. with the following change to your patch, everything is nice and fast,
> AFAICT

Wouldn't it be cleaner to call normpath on those filenames ?
>
> diff -r 802f5d806a9d mercurial/util.py
> --- a/mercurial/util.py Mon Oct 06 11:52:32 2008 +0200
> +++ b/mercurial/util.py Mon Oct 06 12:19:40 2008 +0200
> @@ -1166,6 +1166,8 @@
>        dircache = {}
>        for fn in files:
>            pos = fn.rfind('/')
> +            if pos == -1:
> +                pos = fn.rfind('\\')
>            if pos != -1:
>                dir, base = fn[:pos].lower(), fn[pos+1:].lower()
>            else:
>
>
> -- Christian
>
>


More information about the Mercurial-devel mailing list