comparison mercurial/dirstate.py @ 12211:798d72f3621c

dirstate: use one pass to filter out files in subrepos
author Martin Geisler <mg@lazybytes.net>
date Fri, 10 Sep 2010 23:53:51 +0200
parents 1849b6147831
children e0ee3e822a9a
comparison
equal deleted inserted replaced
12210:21eb85e9ea94 12211:798d72f3621c
495 exact = True 495 exact = True
496 dirignore = util.always # skip step 2 496 dirignore = util.always # skip step 2
497 elif match.files() and not match.anypats(): # match.match, no patterns 497 elif match.files() and not match.anypats(): # match.match, no patterns
498 skipstep3 = True 498 skipstep3 = True
499 499
500 files = set(match.files()) 500 files = sorted(match.files())
501 for s in subrepos: 501 subrepos.sort()
502 files = [f for f in files if not f.startswith(s + "/")] 502 i, j = 0, 0
503 while i < len(files) and j < len(subrepos):
504 subpath = subrepos[j] + "/"
505 if not files[i].startswith(subpath):
506 i += 1
507 continue
508 while files and files[i].startswith(subpath):
509 del files[i]
510 j += 1
511
503 if not files or '.' in files: 512 if not files or '.' in files:
504 files = [''] 513 files = ['']
505 results = dict.fromkeys(subrepos) 514 results = dict.fromkeys(subrepos)
506 results['.hg'] = None 515 results['.hg'] = None
507 516
508 # step 1: find all explicit files 517 # step 1: find all explicit files
509 for ff in sorted(files): 518 for ff in files:
510 nf = normalize(normpath(ff), False) 519 nf = normalize(normpath(ff), False)
511 if nf in results: 520 if nf in results:
512 continue 521 continue
513 522
514 try: 523 try: