Patchwork [7,of,7] record: don't honor format-changing diffopts (issue4459)

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 26, 2014, 3:54 a.m.
Message ID <716d9ab5c1424496bea3.1416974042@devbig136.prn2.facebook.com>
Download mbox | patch
Permalink /patch/6864/
State Accepted
Commit 486a1fe09422f7738ef356bd135376dd1fbefb4b
Headers show

Comments

Siddharth Agarwal - Nov. 26, 2014, 3:54 a.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1416369637 28800
#      Tue Nov 18 20:00:37 2014 -0800
# Node ID 716d9ab5c1424496bea3802cef94283f752d7122
# Parent  7451bf7e463e2932817a08d6b7114ecd363e0cfd
record: don't honor format-changing diffopts (issue4459)

record does support the whitespace options, so honor those. In upcoming patches
we'll replace all the other uses.
Augie Fackler - Dec. 2, 2014, 3:44 p.m.
On Tue, Nov 25, 2014 at 07:54:02PM -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1416369637 28800
> #      Tue Nov 18 20:00:37 2014 -0800
> # Node ID 716d9ab5c1424496bea3802cef94283f752d7122
> # Parent  7451bf7e463e2932817a08d6b7114ecd363e0cfd
> record: don't honor format-changing diffopts (issue4459)

Queued these, many thanks.

>
> record does support the whitespace options, so honor those. In upcoming patches
> we'll replace all the other uses.
>
> diff --git hgext/record.py hgext/record.py
> --- hgext/record.py
> +++ hgext/record.py
> @@ -519,10 +519,9 @@
>                                 '(use "hg commit" instead)'))
>
>          status = repo.status(match=match)
> -        diffopts = opts.copy()
> -        diffopts['nodates'] = True
> -        diffopts['git'] = True
> -        diffopts = patch.diffopts(ui, opts=diffopts)
> +        diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
> +        diffopts.nodates = True
> +        diffopts.git = True
>          chunks = patch.diff(repo, changes=status, opts=diffopts)
>          fp = cStringIO.StringIO()
>          fp.write(''.join(chunks))
> diff --git tests/test-record.t tests/test-record.t
> --- tests/test-record.t
> +++ tests/test-record.t
> @@ -559,9 +559,9 @@
>    >   echo $i >> plain
>    > done
>
> -Record beginning, middle
> +Record beginning, middle, and test that format-breaking diffopts are ignored
>
> -  $ hg record -d '14 0' -m middle-only plain <<EOF
> +  $ hg record --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
>    > y
>    > y
>    > y
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Dec. 2, 2014, 3:48 p.m.
On Tue, Nov 25, 2014 at 07:54:02PM -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1416369637 28800
> #      Tue Nov 18 20:00:37 2014 -0800
> # Node ID 716d9ab5c1424496bea3802cef94283f752d7122
> # Parent  7451bf7e463e2932817a08d6b7114ecd363e0cfd
> record: don't honor format-changing diffopts (issue4459)

Ugh. So, um, 'hg import' can't import your patches, because you sent
diff.noprefix=True patches. Can you add a patch to the end of your
series that disables format-changing for email and send a V3 that just
adds that final patch (with said final patch active so I get proper
patches?)

>
> record does support the whitespace options, so honor those. In upcoming patches
> we'll replace all the other uses.
>
> diff --git hgext/record.py hgext/record.py
> --- hgext/record.py
> +++ hgext/record.py
> @@ -519,10 +519,9 @@
>                                 '(use "hg commit" instead)'))
>
>          status = repo.status(match=match)
> -        diffopts = opts.copy()
> -        diffopts['nodates'] = True
> -        diffopts['git'] = True
> -        diffopts = patch.diffopts(ui, opts=diffopts)
> +        diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
> +        diffopts.nodates = True
> +        diffopts.git = True
>          chunks = patch.diff(repo, changes=status, opts=diffopts)
>          fp = cStringIO.StringIO()
>          fp.write(''.join(chunks))
> diff --git tests/test-record.t tests/test-record.t
> --- tests/test-record.t
> +++ tests/test-record.t
> @@ -559,9 +559,9 @@
>    >   echo $i >> plain
>    > done
>
> -Record beginning, middle
> +Record beginning, middle, and test that format-breaking diffopts are ignored
>
> -  $ hg record -d '14 0' -m middle-only plain <<EOF
> +  $ hg record --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
>    > y
>    > y
>    > y
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Simon King - Dec. 2, 2014, 3:57 p.m.
On Tue, Dec 2, 2014 at 3:48 PM, Augie Fackler <raf@durin42.com> wrote:
> On Tue, Nov 25, 2014 at 07:54:02PM -0800, Siddharth Agarwal wrote:
>> # HG changeset patch
>> # User Siddharth Agarwal <sid0@fb.com>
>> # Date 1416369637 28800
>> #      Tue Nov 18 20:00:37 2014 -0800
>> # Node ID 716d9ab5c1424496bea3802cef94283f752d7122
>> # Parent  7451bf7e463e2932817a08d6b7114ecd363e0cfd
>> record: don't honor format-changing diffopts (issue4459)
>
> Ugh. So, um, 'hg import' can't import your patches, because you sent
> diff.noprefix=True patches. Can you add a patch to the end of your
> series that disables format-changing for email and send a V3 that just
> adds that final patch (with said final patch active so I get proper
> patches?)
>

Can you use "hg import -p0"?

Simon
Augie Fackler - Dec. 2, 2014, 4:01 p.m.
On Tue, Dec 2, 2014 at 10:57 AM, Simon King <simon@simonking.org.uk> wrote:
>> Ugh. So, um, 'hg import' can't import your patches, because you sent
>> diff.noprefix=True patches. Can you add a patch to the end of your
>> series that disables format-changing for email and send a V3 that just
>> adds that final patch (with said final patch active so I get proper
>> patches?)
>>
>
> Can you use "hg import -p0"?


Good catch, taht worked. Done. Sid, I'd still love a followup that
disables noprefix for email. :)
Siddharth Agarwal - Dec. 2, 2014, 5:57 p.m.
On 12/02/2014 08:01 AM, Augie Fackler wrote:
> On Tue, Dec 2, 2014 at 10:57 AM, Simon King <simon@simonking.org.uk> wrote:
>>> Ugh. So, um, 'hg import' can't import your patches, because you sent
>>> diff.noprefix=True patches. Can you add a patch to the end of your
>>> series that disables format-changing for email and send a V3 that just
>>> adds that final patch (with said final patch active so I get proper
>>> patches?)
>>>
>> Can you use "hg import -p0"?
>
> Good catch, taht worked. Done. Sid, I'd still love a followup that
> disables noprefix for email. :)

Ugh, sorry about that. That was actually the very next patch in my series.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Dec. 2, 2014, 6:02 p.m.
On Tue, Dec 2, 2014 at 12:57 PM, Siddharth Agarwal <sid@less-broken.com> wrote:
> On 12/02/2014 08:01 AM, Augie Fackler wrote:
>>
>> On Tue, Dec 2, 2014 at 10:57 AM, Simon King <simon@simonking.org.uk>
>> wrote:
>>>>
>>>> Ugh. So, um, 'hg import' can't import your patches, because you sent
>>>> diff.noprefix=True patches. Can you add a patch to the end of your
>>>> series that disables format-changing for email and send a V3 that just
>>>> adds that final patch (with said final patch active so I get proper
>>>> patches?)
>>>>
>>> Can you use "hg import -p0"?
>>
>>
>> Good catch, taht worked. Done. Sid, I'd still love a followup that
>> disables noprefix for email. :)
>
>
> Ugh, sorry about that. That was actually the very next patch in my series.


No sweat. Mail that series shortly and I'll review it?
Matt Mackall - Dec. 2, 2014, 10:01 p.m.
On Tue, 2014-12-02 at 13:02 -0500, Augie Fackler wrote:
> On Tue, Dec 2, 2014 at 12:57 PM, Siddharth Agarwal <sid@less-broken.com> wrote:
> > On 12/02/2014 08:01 AM, Augie Fackler wrote:
> >>
> >> On Tue, Dec 2, 2014 at 10:57 AM, Simon King <simon@simonking.org.uk>
> >> wrote:
> >>>>
> >>>> Ugh. So, um, 'hg import' can't import your patches, because you sent
> >>>> diff.noprefix=True patches. Can you add a patch to the end of your
> >>>> series that disables format-changing for email and send a V3 that just
> >>>> adds that final patch (with said final patch active so I get proper
> >>>> patches?)
> >>>>
> >>> Can you use "hg import -p0"?
> >>
> >>
> >> Good catch, taht worked. Done. Sid, I'd still love a followup that
> >> disables noprefix for email. :)
> >
> >
> > Ugh, sorry about that. That was actually the very next patch in my series.
> 
> 
> No sweat. Mail that series shortly and I'll review it?

We can probably make import smarter too. If we've provided no -p option
and the files don't start with [ab]/, we can simply assume -p0.

Patch

diff --git hgext/record.py hgext/record.py
--- hgext/record.py
+++ hgext/record.py
@@ -519,10 +519,9 @@ 
                                '(use "hg commit" instead)'))
 
         status = repo.status(match=match)
-        diffopts = opts.copy()
-        diffopts['nodates'] = True
-        diffopts['git'] = True
-        diffopts = patch.diffopts(ui, opts=diffopts)
+        diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
+        diffopts.nodates = True
+        diffopts.git = True
         chunks = patch.diff(repo, changes=status, opts=diffopts)
         fp = cStringIO.StringIO()
         fp.write(''.join(chunks))
diff --git tests/test-record.t tests/test-record.t
--- tests/test-record.t
+++ tests/test-record.t
@@ -559,9 +559,9 @@ 
   >   echo $i >> plain
   > done
 
-Record beginning, middle
+Record beginning, middle, and test that format-breaking diffopts are ignored
 
-  $ hg record -d '14 0' -m middle-only plain <<EOF
+  $ hg record --config diff.noprefix=True -d '14 0' -m middle-only plain <<EOF
   > y
   > y
   > y