# HG changeset patch # User mpm@selenic.com # Date 1118858410 28800 # Node ID dda243bb34b3ac992a34758fd4411bd0bb85582d # Parent ca39b80cbe15c177f87f19318d280188ceeaa8a6 hg addremove: take optional files list -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hg addremove: take optional files list From: Chris Mason Change hg addremove so that it can take a list of files to process instead of searching the entire tree for candidates. manifest hash: 592d8771ea5703dd6ed4459239dab84e15ee9321 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCsGyqywK+sNU5EO8RAt0jAKCSDQ1fxgQNP08kehdxlQwX5DUuuQCgqRB2 7gZoRNyJmOy5BVp6VBmUJbw= =THQB -----END PGP SIGNATURE----- diff -r ca39b80cbe15 -r dda243bb34b3 mercurial/commands.py --- a/mercurial/commands.py Wed Jun 15 09:50:00 2005 -0800 +++ b/mercurial/commands.py Wed Jun 15 10:00:10 2005 -0800 @@ -171,9 +171,22 @@ '''add the specified files on the next commit''' repo.add(relpath(repo, (file,) + files)) -def addremove(ui, repo): +def addremove(ui, repo, *files): """add all new files, delete all missing files""" - (c, a, d, u) = repo.diffdir(repo.root) + if files: + files = relpath(repo, files) + d = [] + u = [] + for f in files: + p = repo.wjoin(f) + s = repo.dirstate.state(f) + isfile = os.path.isfile(p) + if s != 'r' and not isfile: + d.append(f) + elif s not in 'nmai' and isfile: + u.append(f) + else: + (c, a, d, u) = repo.diffdir(repo.root) repo.add(u) repo.remove(d) @@ -573,7 +586,7 @@ table = { "add": (add, [], "hg add [files]"), - "addremove": (addremove, [], "hg addremove"), + "addremove": (addremove, [], "hg addremove [files]"), "ann|annotate": (annotate, [('r', 'revision', '', 'revision'), ('u', 'user', None, 'show user'),