changeset 27680:c750245c6b85

extdiff: factor out list of common options
author Yuya Nishihara <yuya@tcha.org>
date Mon, 04 Jan 2016 22:13:46 +0900
parents 6822f9382b4c
children 174069440929
files hgext/extdiff.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/extdiff.py	Mon Jan 04 21:40:05 2016 +0900
+++ b/hgext/extdiff.py	Mon Jan 04 22:13:46 2016 +0900
@@ -270,15 +270,17 @@
         ui.note(_('cleaning up temp directory\n'))
         shutil.rmtree(tmproot)
 
-@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
+
+@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 @@
             mydiff.__doc__ = doc.decode(encoding.encoding)
             return mydiff
         cmdtable[cmd] = (save(cmdline),
-                         cmdtable['extdiff'][1][1:],
+                         extdiffopts[:],
                          _('hg %s [OPTION]... [FILE]...') % cmd)