changeset 3195:a73a785ea8e1

factor opts: --dry-run option
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 29 Sep 2006 18:39:49 +0200
parents 725e3d3145d8
children 37b53487c341 f2ed26736dfa
files mercurial/commands.py
diffstat 1 files changed, 10 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Sep 29 18:39:32 2006 +0200
+++ b/mercurial/commands.py	Fri Sep 29 18:39:49 2006 +0200
@@ -2672,6 +2672,9 @@
     ('h', 'help', None, _('display help and exit')),
 ]
 
+dryrunopts = [('n', 'dry-run', None,
+               _('do not perform actions, just print output'))]
+
 walkopts = [
     ('I', 'include', [], _('include names matching the given patterns')),
     ('X', 'exclude', [], _('exclude names matching the given patterns')),
@@ -2680,17 +2683,14 @@
 table = {
     "^add":
         (add,
-         walkopts + \
-         [('n', 'dry-run', None,
-           _('do not perform actions, just print output'))],
+         walkopts + dryrunopts,
          _('hg add [OPTION]... [FILE]...')),
     "addremove":
         (addremove,
-         walkopts + \
-         [('n', 'dry-run', None,
-           _('do not perform actions, just print output'))],
+         walkopts + dryrunopts +
          [('s', 'similarity', '',
-           _('guess renamed files by similarity (0<=s<=100)'))],
+           _('guess renamed files by similarity (0<=s<=100)')),
+         ] + walkopts + dryrunopts,
          _('hg addremove [OPTION]... [FILE]...')),
     "^annotate":
         (annotate,
@@ -2760,8 +2760,7 @@
          [('A', 'after', None, _('record a copy that has already occurred')),
           ('f', 'force', None,
            _('forcibly copy over an existing managed file')),
-          ('n', 'dry-run', None, _('do not perform actions, just print output'))],
-         ] + walkopts,
+         ] + walkopts + dryrunopts,
          _('hg copy [OPTION]... [SOURCE]... DEST')),
     "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
     "debugcomplete":
@@ -2954,16 +2953,14 @@
          [('A', 'after', None, _('record a rename that has already occurred')),
           ('f', 'force', None,
            _('forcibly copy over an existing managed file')),
-          ('n', 'dry-run', None, _('do not perform actions, just print output'))],
-         ] + walkopts,
+         ] + walkopts + dryrunopts,
          _('hg rename [OPTION]... SOURCE... DEST')),
     "^revert":
         (revert,
          [('a', 'all', None, _('revert all changes when no arguments given')),
           ('r', 'rev', '', _('revision to revert to')),
           ('', 'no-backup', None, _('do not save backup copies of files')),
-          ('n', 'dry-run', None, _('do not perform actions, just print output'))],
-         ] + walkopts,
+         ] + walkopts + dryrunopts,
          _('hg revert [-r REV] [NAME]...')),
     "rollback": (rollback, [], _('hg rollback')),
     "root": (root, [], _('hg root')),