record: use commands.diffwsopts instead of ad-hoc diffopts
authorJordi Gutiérrez Hermoso <jordigh@octave.org>
Thu, 16 Jan 2014 14:57:52 -0500
changeset 20300 0076643077a3
parent 20299 b4b77909318f
child 20301 4988e4246537
record: use commands.diffwsopts instead of ad-hoc diffopts The record extension is writing its own version of commands.diffwsopts which is identical to commands.diffwsopts. Based on the principle that code duplication increases maintenance burden, this patch removes record's ad-hoc diffopts in favour of commands.diffwsopts
hgext/record.py
--- a/hgext/record.py	Sun Nov 17 11:30:17 2013 -0500
+++ b/hgext/record.py	Thu Jan 16 14:57:52 2014 -0500
@@ -18,15 +18,6 @@
 
 lines_re = re.compile(r'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)')
 
-diffopts = [
-    ('w', 'ignore-all-space', False,
-     _('ignore white space when comparing lines')),
-    ('b', 'ignore-space-change', None,
-     _('ignore changes in the amount of white space')),
-    ('B', 'ignore-blank-lines', None,
-     _('ignore changes whose lines are all blank')),
-]
-
 def scanpatch(fp):
     """like patch.iterhunks, but yield different events
 
@@ -420,7 +411,7 @@
 
 @command("record",
          # same options as commit + white space diff options
-         commands.table['^commit|ci'][1][:] + diffopts,
+         commands.table['^commit|ci'][1][:] + commands.diffwsopts,
           _('hg record [OPTION]... [FILE]...'))
 def record(ui, repo, *pats, **opts):
     '''interactively select changes to commit
@@ -665,7 +656,7 @@
         (qrecord,
          # same options as qnew, but copy them so we don't get
          # -i/--interactive for qrecord and add white space diff options
-         mq.cmdtable['^qnew'][1][:] + diffopts,
+         mq.cmdtable['^qnew'][1][:] + commands.diffwsopts,
          _('hg qrecord [OPTION]... PATCH [FILE]...'))
 
     _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))