mercurial/dirstate.py
changeset 12211 798d72f3621c
parent 12164 1849b6147831
child 12345 e0ee3e822a9a
--- 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