add -f/--force to remove command.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Wed, 08 Mar 2006 15:14:24 -0800
changeset 1867 91ebf29c1595
parent 1865 1ed809a2104e
child 1868 6a3d5a56f19c
add -f/--force to remove command. else to remove modified file, must use "hg revert; hg rm" or "rm; hg rm --after".
mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1920,7 +1920,7 @@ def remove(ui, repo, pat, *pats, **opts)
     def okaytoremove(abs, rel, exact):
         modified, added, removed, deleted, unknown = repo.changes(files=[abs])
         reason = None
-        if modified:
+        if modified and not opts['force']:
             reason = _('is modified')
         elif added:
             reason = _('has been marked for add')
@@ -2564,7 +2564,8 @@ table = {
     "^remove|rm":
         (remove,
          [('I', 'include', [], _('include names matching the given patterns')),
-          ('X', 'exclude', [], _('exclude names matching the given patterns'))],
+          ('X', 'exclude', [], _('exclude names matching the given patterns')),
+          ('f', 'force', None, _('remove file even if modified'))],
          _('hg remove [OPTION]... FILE...')),
     "rename|mv":
         (rename,