equal
deleted
inserted
replaced
458 lnkkind = stat.S_IFLNK |
458 lnkkind = stat.S_IFLNK |
459 join = self._join |
459 join = self._join |
460 work = [] |
460 work = [] |
461 wadd = work.append |
461 wadd = work.append |
462 |
462 |
463 if match.anypats(): # match.match or .exact with patterns |
463 exact = skipstep3 = False |
464 dostep3 = True |
464 if matchfn == match.exact: # match.exact |
465 exact = False |
|
466 elif matchfn == match.exact: # match.exact without patterns |
|
467 dostep3 = False |
|
468 exact = True |
465 exact = True |
469 elif match.files(): # match.match without patterns |
466 dirignore = util.always # skip step 2 |
470 dostep3 = False |
467 elif match.files() and not match.anypats(): # match.match, no patterns |
471 exact = False |
468 skipstep3 = True |
472 else: # match.always |
|
473 dostep3 = True |
|
474 exact = False |
|
475 |
|
476 if exact: # skip step 2 |
|
477 dirignore = util.always |
|
478 |
469 |
479 files = set(match.files()) |
470 files = set(match.files()) |
480 if not files or '.' in files: |
471 if not files or '.' in files: |
481 files = [''] |
472 files = [''] |
482 results = {'.hg': None} |
473 results = {'.hg': None} |
489 |
480 |
490 try: |
481 try: |
491 st = lstat(join(nf)) |
482 st = lstat(join(nf)) |
492 kind = getkind(st.st_mode) |
483 kind = getkind(st.st_mode) |
493 if kind == dirkind: |
484 if kind == dirkind: |
494 dostep3 = True |
485 skipstep3 = False |
495 if nf in dmap: |
486 if nf in dmap: |
496 #file deleted on disk but still in dirstate |
487 #file deleted on disk but still in dirstate |
497 results[nf] = None |
488 results[nf] = None |
498 if not dirignore(nf): |
489 if not dirignore(nf): |
499 wadd(nf) |
490 wadd(nf) |
508 results[nf] = None |
499 results[nf] = None |
509 else: # does it match a directory? |
500 else: # does it match a directory? |
510 prefix = nf + "/" |
501 prefix = nf + "/" |
511 for fn in dmap: |
502 for fn in dmap: |
512 if fn.startswith(prefix): |
503 if fn.startswith(prefix): |
513 dostep3 = True |
504 skipstep3 = False |
514 break |
505 break |
515 else: |
506 else: |
516 badfn(ff, inst.strerror) |
507 badfn(ff, inst.strerror) |
517 |
508 |
518 # step 2: visit subdirectories |
509 # step 2: visit subdirectories |
548 results[nf] = st |
539 results[nf] = st |
549 elif nf in dmap and matchfn(nf): |
540 elif nf in dmap and matchfn(nf): |
550 results[nf] = None |
541 results[nf] = None |
551 |
542 |
552 # step 3: report unseen items in the dmap hash |
543 # step 3: report unseen items in the dmap hash |
553 if dostep3 and not exact: |
544 if not skipstep3 and not exact: |
554 visit = sorted([f for f in dmap if f not in results and matchfn(f)]) |
545 visit = sorted([f for f in dmap if f not in results and matchfn(f)]) |
555 for nf, st in zip(visit, util.statfiles([join(i) for i in visit])): |
546 for nf, st in zip(visit, util.statfiles([join(i) for i in visit])): |
556 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind): |
547 if not st is None and not getkind(st.st_mode) in (regkind, lnkkind): |
557 st = None |
548 st = None |
558 results[nf] = st |
549 results[nf] = st |