Mercurial > hg
diff mercurial/commands.py @ 1188:b3ceb2d470fc
Fix up remove command to use walk code.
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 01 Sep 2005 07:48:14 -0700 |
parents | 120aa5fc7ced |
children | 4cbcc54695b2 |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Sep 01 07:47:26 2005 -0700 +++ b/mercurial/commands.py Thu Sep 01 07:48:14 2005 -0700 @@ -1262,9 +1262,23 @@ """roll back an interrupted transaction""" repo.recover() -def remove(ui, repo, file1, *files): +def remove(ui, repo, pat, *pats, **opts): """remove the specified files on the next commit""" - repo.remove(relpath(repo, (file1,) + files)) + names = [] + for src, abs, rel, exact in walk(repo, (pat,) + pats, opts): + if exact: + skip = {'m': 'file has pending merge', + 'a': 'file has been marked for add (use forget)', + '?': 'file not managed'} + reason = skip.get(repo.dirstate.state(abs)) + if reason: + ui.warn('not removing %s: %s\n' % (rel, reason)) + else: + names.append(abs) + elif repo.dirstate.state(abs) == 'n': + ui.status('removing %s\n' % rel) + names.append(abs) + repo.remove(names) def revert(ui, repo, *names, **opts): """revert modified files or dirs back to their unmodified states""" @@ -1697,7 +1711,10 @@ ('l', 'logfile', "", 'commit message file')], 'hg rawcommit [OPTION]... [FILE]...'), "recover": (recover, [], "hg recover"), - "^remove|rm": (remove, [], "hg remove FILE..."), + "^remove|rm": (remove, + [('I', 'include', [], 'include path in search'), + ('X', 'exclude', [], 'exclude path from search')], + "hg remove [OPTION]... FILE..."), "^revert": (revert, [("n", "nonrecursive", None, "don't recurse into subdirs"),