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

Siddharth Agarwal sid0 at fb.com
Tue May 7 16:14:25 CDT 2013


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.

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.


More information about the Mercurial-devel mailing list