184 if similarity is None: |
184 if similarity is None: |
185 similarity = float(opts.get('similarity') or 0) |
185 similarity = float(opts.get('similarity') or 0) |
186 add, remove = [], [] |
186 add, remove = [], [] |
187 mapping = {} |
187 mapping = {} |
188 for src, abs, rel, exact in walk(repo, pats, opts): |
188 for src, abs, rel, exact in walk(repo, pats, opts): |
|
189 target = repo.wjoin(abs) |
189 if src == 'f' and repo.dirstate.state(abs) == '?': |
190 if src == 'f' and repo.dirstate.state(abs) == '?': |
190 add.append(abs) |
191 add.append(abs) |
191 mapping[abs] = rel, exact |
192 mapping[abs] = rel, exact |
192 if repo.ui.verbose or not exact: |
193 if repo.ui.verbose or not exact: |
193 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
194 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
194 islink = os.path.islink(rel) |
195 islink = os.path.islink(target) |
195 if repo.dirstate.state(abs) != 'r' and not islink and not os.path.exists(rel): |
196 if (repo.dirstate.state(abs) != 'r' and not islink |
|
197 and not os.path.exists(target)): |
196 remove.append(abs) |
198 remove.append(abs) |
197 mapping[abs] = rel, exact |
199 mapping[abs] = rel, exact |
198 if repo.ui.verbose or not exact: |
200 if repo.ui.verbose or not exact: |
199 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
201 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
200 if not dry_run: |
202 if not dry_run: |