731 audit_path = pathauditor(repo.root) |
731 audit_path = pathauditor(repo.root) |
732 m = match(repo[None], pats, opts) |
732 m = match(repo[None], pats, opts) |
733 rejected = [] |
733 rejected = [] |
734 m.bad = lambda x, y: rejected.append(x) |
734 m.bad = lambda x, y: rejected.append(x) |
735 |
735 |
736 for abs in repo.walk(m): |
736 ctx = repo[None] |
737 target = repo.wjoin(abs) |
737 walkresults = repo.dirstate.walk(m, sorted(ctx.substate), True, False) |
|
738 for abs in sorted(walkresults): |
738 good = True |
739 good = True |
739 try: |
740 try: |
740 audit_path(abs) |
741 audit_path(abs) |
741 except (OSError, util.Abort): |
742 except (OSError, util.Abort): |
742 good = False |
743 good = False |
743 rel = m.rel(abs) |
744 rel = m.rel(abs) |
744 exact = m.exact(abs) |
745 exact = m.exact(abs) |
745 |
746 |
|
747 st = walkresults[abs] |
746 dstate = repo.dirstate[abs] |
748 dstate = repo.dirstate[abs] |
747 if good and dstate == '?': |
749 if good and dstate == '?': |
748 unknown.append(abs) |
750 unknown.append(abs) |
749 if repo.ui.verbose or not exact: |
751 if repo.ui.verbose or not exact: |
750 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
752 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
751 elif (dstate != 'r' and |
753 elif (dstate != 'r' and |
752 (not good or not os.path.lexists(target) or |
754 (not good or not st or |
753 (os.path.isdir(target) and not os.path.islink(target)))): |
755 (stat.S_ISDIR(st.st_mode) and not stat.S_ISLNK(st.st_mode)))): |
754 deleted.append(abs) |
756 deleted.append(abs) |
755 if repo.ui.verbose or not exact: |
757 if repo.ui.verbose or not exact: |
756 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
758 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
757 # for finding renames |
759 # for finding renames |
758 elif dstate == 'r': |
760 elif dstate == 'r': |