636 similarity = float(opts.get('similarity') or 0) |
636 similarity = float(opts.get('similarity') or 0) |
637 add, remove = [], [] |
637 add, remove = [], [] |
638 mapping = {} |
638 mapping = {} |
639 for src, abs, rel, exact in walk(repo, pats, opts): |
639 for src, abs, rel, exact in walk(repo, pats, opts): |
640 target = repo.wjoin(abs) |
640 target = repo.wjoin(abs) |
641 if src == 'f' and repo.dirstate.state(abs) == '?': |
641 if src == 'f' and abs not in repo.dirstate: |
642 add.append(abs) |
642 add.append(abs) |
643 mapping[abs] = rel, exact |
643 mapping[abs] = rel, exact |
644 if repo.ui.verbose or not exact: |
644 if repo.ui.verbose or not exact: |
645 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
645 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
646 if repo.dirstate.state(abs) != 'r' and not util.lexists(target): |
646 if repo.dirstate[abs] != 'r' and not util.lexists(target): |
647 remove.append(abs) |
647 remove.append(abs) |
648 mapping[abs] = rel, exact |
648 mapping[abs] = rel, exact |
649 if repo.ui.verbose or not exact: |
649 if repo.ui.verbose or not exact: |
650 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
650 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
651 if not dry_run: |
651 if not dry_run: |