Patchwork [1,of,2] record: use commands.diffwsopts instead of ad-hoc diffopts

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date Jan. 16, 2014, 8:07 p.m.
Message ID <95a53ad012b6d5a640e9.1389902823@Iris>
Download mbox | patch
Permalink /patch/3360/
State Accepted
Commit 0076643077a3ff7e77f71b5ae22b50cc1164c108
Headers show

Comments

Jordi Gutiérrez Hermoso - Jan. 16, 2014, 8:07 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1389902272 18000
#      Thu Jan 16 14:57:52 2014 -0500
# Node ID 95a53ad012b6d5a640e91140a7da1a5f3f3df552
# Parent  0763d829cbea95a02a6a2cb71f3cebdb49011cf2
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

Patch

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -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"))