# HG changeset patch # User Martin Geisler # Date 1284155631 -7200 # Node ID 798d72f3621cd25bc54fc1fba6092b5e97b79b66 # Parent 21eb85e9ea94533f5032d30b606b0da661aff651 dirstate: use one pass to filter out files in subrepos diff -r 21eb85e9ea94 -r 798d72f3621c mercurial/dirstate.py --- a/mercurial/dirstate.py Fri Sep 10 23:53:49 2010 +0200 +++ b/mercurial/dirstate.py Fri Sep 10 23:53:51 2010 +0200 @@ -497,16 +497,25 @@ elif match.files() and not match.anypats(): # match.match, no patterns skipstep3 = True - files = set(match.files()) - for s in subrepos: - files = [f for f in files if not f.startswith(s + "/")] + files = sorted(match.files()) + subrepos.sort() + i, j = 0, 0 + while i < len(files) and j < len(subrepos): + subpath = subrepos[j] + "/" + if not files[i].startswith(subpath): + i += 1 + continue + while files and files[i].startswith(subpath): + del files[i] + j += 1 + if not files or '.' in files: files = [''] results = dict.fromkeys(subrepos) results['.hg'] = None # step 1: find all explicit files - for ff in sorted(files): + for ff in files: nf = normalize(normpath(ff), False) if nf in results: continue