Commit 6be3f7dd authored by Bryan O'Sullivan's avatar Bryan O'Sullivan
Browse files

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.
parent 1e31d97c3d70
......@@ -60,7 +60,7 @@ add [options] [files ...]::
If no names are given, add all files in the current directory and
its subdirectories.
addremove [options] [files ...]::
Add all new files and remove all missing files from the repository.
New files are ignored if they match any of the patterns in .hgignore. As
......@@ -329,23 +329,19 @@ def add(ui, repo, *pats, **opts):
def addremove(ui, repo, *files):
def addremove(ui, repo, *pats, **opts):
"""add all new files, delete all missing files"""
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:
elif s not in 'nmai' and isfile:
(c, a, d, u) = repo.changes()
q = dict(zip(pats, pats))
cwd = repo.getcwd()
n = (cwd and len(cwd) + 1) or 0
c, a, d, u = repo.changes(match = matchpats(cwd, pats, opts))
for f in u:
if f not in q:
ui.status('adding %s\n' % f[n:])
for f in d:
if f not in q:
ui.status('removing %s\n' % f[n:])
def annotate(ui, repo, *pats, **opts):
......@@ -1086,7 +1082,10 @@ table = {
[('I', 'include', [], 'include path in search'),
('X', 'exclude', [], 'exclude path from search')],
"hg add [FILE]..."),
"addremove": (addremove, [], "hg addremove [FILE]..."),
"addremove": (addremove,
[('I', 'include', [], 'include path in search'),
('X', 'exclude', [], 'exclude path from search')],
"hg addremove [OPTION]... [FILE]..."),
[('r', 'rev', '', 'revision'),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment