Mercurial > hg
changeset 353:dda243bb34b3
hg addremove: take optional files list
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hg addremove: take optional files list
From: Chris Mason <mason@suse.com>
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-----
author | mpm@selenic.com |
---|---|
date | Wed, 15 Jun 2005 10:00:10 -0800 |
parents | ca39b80cbe15 |
children | e3667e3a18ac |
files | mercurial/commands.py |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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'),