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