[PATCH 4 of 4] dirstate: speed up case collision checking

Joshua Redstone joshua.redstone at fb.com
Mon Jun 25 10:49:27 CDT 2012


On 06/22/2012 05:41 PM, Bryan O'Sullivan wrote:
>
>     +        dirlevel = path.count('/')
>
>
> But if I'm wrong about the origin of these names and they're actually 
> filesystem names, then you should be counting os.sep here, not '/', 
> because '/' will not be the separator on Windows.

pmezard mentioned thinking that paths were converted to '/' and it was 
ok to use that fact.  One note about the '/' counting is that the code 
uses that only as an optimization to tell when we don't need to both 
considering if two paths could case collide, the idea being that if they 
are at different levels in the treee, they can't possibly case collide.  
So it's ok if dirlevel doesn't quite correspond to the real level as 
long as it has the property that if two paths have a different number of 
slashes, they can't possibly case collide and so we don't need to bother 
to check.
Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120625/6c8f6f80/attachment.html>


More information about the Mercurial-devel mailing list