changeset 2413:c1ec81319870

copy: add -n/--dry-run option
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 09 Jun 2006 08:48:30 -0700
parents e5cb39577b9f
children 86e07466bcfc
files mercurial/commands.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 09 08:42:36 2006 -0700
+++ b/mercurial/commands.py	Fri Jun 09 08:48:30 2006 -0700
@@ -1172,9 +1172,10 @@
     if not copylist:
         raise util.Abort(_('no files to copy'))
 
-    for targetpath, srcs in copylist:
-        for origsrc, abssrc, relsrc, exact in srcs:
-            copy(origsrc, abssrc, relsrc, targetpath(abssrc), exact)
+    if not opts.get('dry_run'):
+        for targetpath, srcs in copylist:
+            for origsrc, abssrc, relsrc, exact in srcs:
+                copy(origsrc, abssrc, relsrc, targetpath(abssrc), exact)
 
     if errors:
         ui.warn(_('(consider using --after)\n'))
@@ -2882,7 +2883,8 @@
           ('f', 'force', None,
            _('forcibly copy over an existing managed file')),
           ('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 copy [OPTION]... [SOURCE]... DEST')),
     "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
     "debugcomplete":