[PATCH 2 of 3] merge: use dirstate.notincluded in _checkunknown

Matt Mackall mpm at selenic.com
Fri Feb 1 17:36:19 CST 2013


On Fri, 2013-02-01 at 14:41 -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0 at fb.com>
> # Date 1359674799 28800
> # Branch stable
> # Node ID 802db8814a53d3e1c0bd4d444e9a70158bd48396
> # Parent  9139388e66b4c6295c85989f27357c280a40025d
> merge: use dirstate.notincluded in _checkunknown
> 
> On a repository with over 150,000 files, this speeds up update by around 0.4
> seconds.
> 
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -101,8 +101,8 @@ def _checkunknown(repo, wctx, mctx):
>      "check for collisions between unknown files and files in mctx"
>  
>      error = False
> -    for f in mctx:
> -        if f not in wctx and _checkunknownfile(repo, wctx, mctx, f):
> +    for f in repo.dirstate.notincluded(mctx):
> +        if _checkunknownfile(repo, wctx, mctx, f):
>              error = True
>              wctx._repo.ui.warn(_("%s: untracked file differs\n") % f)
>      if error:

I think we should restructure the unknown and collision checks instead.

In particular, I think we should do manifestmerge, then take the
resulting action list and figure out all the "interesting" files that
we're going to touch or remove and decide if they create problems. The
"interesting list" will generally be shorter and thus be less of an
overhead here. Also, because it's after the merge, we won't have false
positives that the merge would remove.

We'll want Mads' code to defer prompting to make this work.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list