Patchwork [V2] record: use patch.diffopts to account for user diffopts

login
register
mail settings
Submitter Denis Laxalde
Date Jan. 8, 2013, 8:52 p.m.
Message ID <20130108205252.GA5591@larron.laxalde.org>
Download mbox | patch
Permalink /patch/508/
State Accepted
Commit 09a2b6741695f7e5c1ef64f3a94139625ec99c1b
Headers show

Comments

Denis Laxalde - Jan. 8, 2013, 8:52 p.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1357676199 -3600
# Node ID 843b338c85283778a128e393ea6c34d9f5ef7c64
# Parent  2c1276825e938872ebc099c191eb202f0dbadfcc
record: use patch.diffopts to account for user diffopts

This allows user defined diff options (e.g. showfunc) to be accounted for
when using record. A test has been updated accordingly.
Bryan O'Sullivan - Jan. 9, 2013, 1:17 a.m.
On Tue, Jan 8, 2013 at 12:52 PM, Denis Laxalde <denis@laxalde.org> wrote:

> record: use patch.diffopts to account for user diffopts
>

Applied, thanks.

Patch

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -520,11 +520,11 @@  def dorecord(ui, repo, commitfunc, cmdsu
                                '(use "hg commit" instead)'))
 
         changes = repo.status(match=match)[:3]
-        diffopts = mdiff.diffopts(
+        diffopts = patch.diffopts(ui, opts=dict(
             git=True, nodates=True,
             ignorews=opts.get('ignore_all_space'),
             ignorewsamount=opts.get('ignore_space_change'),
-            ignoreblanklines=opts.get('ignore_blank_lines'))
+            ignoreblanklines=opts.get('ignore_blank_lines')))
         chunks = patch.diff(repo, changes=changes, opts=diffopts)
         fp = cStringIO.StringIO()
         fp.write(''.join(chunks))
diff --git a/tests/test-record.t b/tests/test-record.t
--- a/tests/test-record.t
+++ b/tests/test-record.t
@@ -255,18 +255,18 @@  Modify end of plain file with username u
   [255]
 
 
-Modify end of plain file
+Modify end of plain file, also test that diffopts are accounted for
 
   $ HGUSER="test"
   $ export HGUSER
-  $ hg record -d '8 0' -m end plain <<EOF
+  $ hg record --config diff.showfunc=true -d '8 0' -m end plain <<EOF
   > y
   > y
   > EOF
   diff --git a/plain b/plain
   1 hunks, 1 lines changed
   examine changes to 'plain'? [Ynesfdaq?] 
-  @@ -8,3 +8,4 @@
+  @@ -8,3 +8,4 @@ 7
    8
    9
    10