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

Patrick Mézard patrick at mezard.eu
Mon Jun 25 11:26:41 CDT 2012


Le 25/06/12 17:49, Joshua Redstone a écrit :
> 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.

That said, splitting explicitely on '/' is sure to work in this case and can be clearer.

Also, I have not check that replacing workingctx._manifest is equivalent to dirstate.sortedfiles() in this case.
--
Patrick Mézard


More information about the Mercurial-devel mailing list