391 def addremove(ui, repo, *pats, **opts): |
391 def addremove(ui, repo, *pats, **opts): |
392 """add all new files, delete all missing files""" |
392 """add all new files, delete all missing files""" |
393 q = dict(zip(pats, pats)) |
393 q = dict(zip(pats, pats)) |
394 add, remove = [], [] |
394 add, remove = [], [] |
395 for src, abs, rel in walk(repo, pats, opts): |
395 for src, abs, rel in walk(repo, pats, opts): |
396 if src == 'f': |
396 if src == 'f' and repo.dirstate.state(abs) == '?': |
397 if repo.dirstate.state(abs) == '?': |
397 add.append(abs) |
398 add.append(abs) |
398 if rel not in q: ui.status('adding ', rel, '\n') |
399 if rel not in q: ui.status('adding ', rel, '\n') |
399 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel): |
400 elif repo.dirstate.state(abs) != 'r' and not os.path.exists(rel): |
|
401 remove.append(abs) |
400 remove.append(abs) |
402 if rel not in q: ui.status('removing ', rel, '\n') |
401 if rel not in q: ui.status('removing ', rel, '\n') |
403 repo.add(add) |
402 repo.add(add) |
404 repo.remove(remove) |
403 repo.remove(remove) |
405 |
404 |