Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 766:b444a7e053f1
Get addremove to use new walk code.
It is now more verbose than it used to be. If given file names, it
prints nothing, as before. But if given patterns or nothing, it prints
the names of the files it is operating on, to remove that air of mystery.
It also now operates at or below the current directory.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Fri, 22 Jul 2005 19:45:48 -0800 |
parents | eea96285cbf9 |
children | b3820ce0e88a |
comparison
equal
deleted
inserted
replaced
765:1e31d97c3d70 | 766:b444a7e053f1 |
---|---|
327 elif repo.dirstate.state(abs) == '?': | 327 elif repo.dirstate.state(abs) == '?': |
328 ui.status('adding %s\n' % rel) | 328 ui.status('adding %s\n' % rel) |
329 names.append(abs) | 329 names.append(abs) |
330 repo.add(names) | 330 repo.add(names) |
331 | 331 |
332 def addremove(ui, repo, *files): | 332 def addremove(ui, repo, *pats, **opts): |
333 """add all new files, delete all missing files""" | 333 """add all new files, delete all missing files""" |
334 if files: | 334 q = dict(zip(pats, pats)) |
335 files = relpath(repo, files) | 335 cwd = repo.getcwd() |
336 d = [] | 336 n = (cwd and len(cwd) + 1) or 0 |
337 u = [] | 337 c, a, d, u = repo.changes(match = matchpats(cwd, pats, opts)) |
338 for f in files: | 338 for f in u: |
339 p = repo.wjoin(f) | 339 if f not in q: |
340 s = repo.dirstate.state(f) | 340 ui.status('adding %s\n' % f[n:]) |
341 isfile = os.path.isfile(p) | |
342 if s != 'r' and not isfile: | |
343 d.append(f) | |
344 elif s not in 'nmai' and isfile: | |
345 u.append(f) | |
346 else: | |
347 (c, a, d, u) = repo.changes() | |
348 repo.add(u) | 341 repo.add(u) |
342 for f in d: | |
343 if f not in q: | |
344 ui.status('removing %s\n' % f[n:]) | |
349 repo.remove(d) | 345 repo.remove(d) |
350 | 346 |
351 def annotate(ui, repo, *pats, **opts): | 347 def annotate(ui, repo, *pats, **opts): |
352 """show changeset information per file line""" | 348 """show changeset information per file line""" |
353 def getnode(rev): | 349 def getnode(rev): |
1084 table = { | 1080 table = { |
1085 "^add": (add, | 1081 "^add": (add, |
1086 [('I', 'include', [], 'include path in search'), | 1082 [('I', 'include', [], 'include path in search'), |
1087 ('X', 'exclude', [], 'exclude path from search')], | 1083 ('X', 'exclude', [], 'exclude path from search')], |
1088 "hg add [FILE]..."), | 1084 "hg add [FILE]..."), |
1089 "addremove": (addremove, [], "hg addremove [FILE]..."), | 1085 "addremove": (addremove, |
1086 [('I', 'include', [], 'include path in search'), | |
1087 ('X', 'exclude', [], 'exclude path from search')], | |
1088 "hg addremove [OPTION]... [FILE]..."), | |
1090 "^annotate": | 1089 "^annotate": |
1091 (annotate, | 1090 (annotate, |
1092 [('r', 'rev', '', 'revision'), | 1091 [('r', 'rev', '', 'revision'), |
1093 ('u', 'user', None, 'show user'), | 1092 ('u', 'user', None, 'show user'), |
1094 ('n', 'number', None, 'show revision number'), | 1093 ('n', 'number', None, 'show revision number'), |