comparison mercurial/commands.py @ 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 b4e0e20646bb
children e3667e3a18ac
comparison
equal deleted inserted replaced
352:ca39b80cbe15 353:dda243bb34b3
169 169
170 def add(ui, repo, file, *files): 170 def add(ui, repo, file, *files):
171 '''add the specified files on the next commit''' 171 '''add the specified files on the next commit'''
172 repo.add(relpath(repo, (file,) + files)) 172 repo.add(relpath(repo, (file,) + files))
173 173
174 def addremove(ui, repo): 174 def addremove(ui, repo, *files):
175 """add all new files, delete all missing files""" 175 """add all new files, delete all missing files"""
176 (c, a, d, u) = repo.diffdir(repo.root) 176 if files:
177 files = relpath(repo, files)
178 d = []
179 u = []
180 for f in files:
181 p = repo.wjoin(f)
182 s = repo.dirstate.state(f)
183 isfile = os.path.isfile(p)
184 if s != 'r' and not isfile:
185 d.append(f)
186 elif s not in 'nmai' and isfile:
187 u.append(f)
188 else:
189 (c, a, d, u) = repo.diffdir(repo.root)
177 repo.add(u) 190 repo.add(u)
178 repo.remove(d) 191 repo.remove(d)
179 192
180 def annotate(u, repo, file, *files, **ops): 193 def annotate(u, repo, file, *files, **ops):
181 """show changeset information per file line""" 194 """show changeset information per file line"""
571 584
572 # Command options and aliases are listed here, alphabetically 585 # Command options and aliases are listed here, alphabetically
573 586
574 table = { 587 table = {
575 "add": (add, [], "hg add [files]"), 588 "add": (add, [], "hg add [files]"),
576 "addremove": (addremove, [], "hg addremove"), 589 "addremove": (addremove, [], "hg addremove [files]"),
577 "ann|annotate": (annotate, 590 "ann|annotate": (annotate,
578 [('r', 'revision', '', 'revision'), 591 [('r', 'revision', '', 'revision'),
579 ('u', 'user', None, 'show user'), 592 ('u', 'user', None, 'show user'),
580 ('n', 'number', None, 'show revision number'), 593 ('n', 'number', None, 'show revision number'),
581 ('c', 'changeset', None, 'show changeset')], 594 ('c', 'changeset', None, 'show changeset')],