addremove: add -n/--dry-run option
authorVadim Gelfer <vadim.gelfer@gmail.com>
Fri, 09 Jun 2006 08:42:36 -0700
changeset 2412 e5cb39577b9f
parent 2411 734df6333ca4
child 2413 c1ec81319870
addremove: add -n/--dry-run option
mercurial/commands.py
--- a/mercurial/commands.py	Fri Jun 09 08:40:06 2006 -0700
+++ b/mercurial/commands.py	Fri Jun 09 08:42:36 2006 -0700
@@ -671,8 +671,9 @@
             remove.append(abs)
             if ui.verbose or not exact:
                 ui.status(_('removing %s\n') % ((pats and rel) or abs))
-    repo.add(add, wlock=wlock)
-    repo.remove(remove, wlock=wlock)
+    if not opts.get('dry_run'):
+        repo.add(add, wlock=wlock)
+        repo.remove(remove, wlock=wlock)
 
 def annotate(ui, repo, *pats, **opts):
     """show changeset information per file line
@@ -2808,7 +2809,8 @@
     "debugaddremove|addremove":
         (addremove,
          [('I', 'include', [], _('include names matching the given patterns')),
-          ('X', 'exclude', [], _('exclude names matching the given patterns'))],
+          ('X', 'exclude', [], _('exclude names matching the given patterns')),
+          ('n', 'dry-run', None, _('print what would be done'))],
          _('hg addremove [OPTION]... [FILE]...')),
     "^annotate":
         (annotate,