[PATCH 2 of 3] extdiff: factor out list of common options

Yuya Nishihara yuya at tcha.org
Wed Jan 6 15:31:01 UTC 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1451913226 -32400
#      Mon Jan 04 22:13:46 2016 +0900
# Node ID 7cef792466ed42cf6c619992a7bbc51ab7a9c33e
# Parent  06021ff117bdcab43cfc3430531985501c635739
extdiff: factor out list of common options

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -270,15 +270,17 @@ def dodiff(ui, repo, cmdline, pats, opts
         ui.note(_('cleaning up temp directory\n'))
         shutil.rmtree(tmproot)
 
- at command('extdiff',
-    [('p', 'program', '',
-     _('comparison program to run'), _('CMD')),
+extdiffopts = [
     ('o', 'option', [],
      _('pass option to comparison program'), _('OPT')),
     ('r', 'rev', [], _('revision'), _('REV')),
     ('c', 'change', '', _('change made by revision'), _('REV')),
     ('', 'patch', None, _('compare patches for two revisions'))
-    ] + commands.walkopts + commands.subrepoopts,
+    ] + commands.walkopts + commands.subrepoopts
+
+ at command('extdiff',
+    [('p', 'program', '', _('comparison program to run'), _('CMD')),
+     ] + extdiffopts,
     _('hg extdiff [OPT]... [FILE]...'),
     inferrepo=True)
 def extdiff(ui, repo, *pats, **opts):
@@ -368,5 +370,5 @@ use %(path)s to diff repository (or sele
             mydiff.__doc__ = doc.decode(encoding.encoding)
             return mydiff
         cmdtable[cmd] = (save(cmdline),
-                         cmdtable['extdiff'][1][1:],
+                         extdiffopts[:],
                          _('hg %s [OPTION]... [FILE]...') % cmd)



More information about the Mercurial-devel mailing list