[PATCH 2 of 7 STABLE] merge: check collision between files and directories before updating (issue29)

Matt Mackall mpm at selenic.com
Tue May 7 16:36:27 CDT 2013


On Tue, 2013-05-07 at 14:14 -0700, Siddharth Agarwal wrote:
> On 05/06/2013 01:35 PM, FUJIWARA Katsunori wrote:
> > +
> > +    # check collision in provisional merged manifest
> > +    if normcase:
> > +        def normiter():
> > +            for f in pmmf:
> > +                yield normcase(f)
> > +        dirs = scmutil.dirs(normiter())
> > +        for f in sorted(pmmf):
> > +            check(f, normcase(f))
> > +    else:
> > +        dirs = scmutil.dirs(pmmf)
> > +        for f in sorted(pmmf):
> > +            check(f, f)
> 
> This is going to be super expensive for large repositories, involving:
> - listing all the dirs, which is faster than it used to be but still 
> fairly slow.
> - a sorted call, which is even more expensive than dirs!
> - a call to check() for each file.

I've asked Siddarth to take a look at this patch because he's been
trying to optimize this code for a repo that has half a million files
where this stuff becomes very noticeable.

One optimization that suggests itself: we might not need to build dirs
if we're not creating any new files. We currently don't have a
distinction in the action list for getting a new file and overriding an
old one, but we could add one.

> Having the list of dirs may be necessary, but maybe there's a way of 
> reusing the dirs from the dirstate that we may already have? The sorted 
> call on the full manifest can be replaced with building up a list of 
> files you need to print (which will be much smaller) and sorting that 
> instead. The check call can be inlined.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list