Patchwork [3,of,3,stable] mq: when adding headers in plain mode, separate them from message (issue4453)

login
register
mail settings
Submitter Mads Kiilerich
Date Nov. 17, 2014, 12:52 a.m.
Message ID <18220555396adc2bcbc7.1416185551@localhost.localdomain>
Download mbox | patch
Permalink /patch/6766/
State Accepted
Commit 5ccced6eab0be9e3479e7981687c6a0ab937fa15
Headers show

Comments

Mads Kiilerich - Nov. 17, 2014, 12:52 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1416185323 -3600
#      Mon Nov 17 01:48:43 2014 +0100
# Branch stable
# Node ID 18220555396adc2bcbc7f3afa7542524f1bb151c
# Parent  f8909f21ae9f3589cc60ab4f2629a446df921c31
mq: when adding headers in plain mode, separate them from message (issue4453)

c87f2a5a6e49 did a clean-up in one direction ... but we want it in the other
direction.
Augie Fackler - Nov. 25, 2014, 3:43 p.m.
On Mon, Nov 17, 2014 at 01:52:31AM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1416185323 -3600
> #      Mon Nov 17 01:48:43 2014 +0100
> # Branch stable
> # Node ID 18220555396adc2bcbc7f3afa7542524f1bb151c
> # Parent  f8909f21ae9f3589cc60ab4f2629a446df921c31
> mq: when adding headers in plain mode, separate them from message (issue4453)

These look good, queued for stable. Thanks!

>
> c87f2a5a6e49 did a clean-up in one direction ... but we want it in the other
> direction.
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -151,6 +151,8 @@ def inserthgheader(lines, header, value)
>      return lines
>
>  def insertplainheader(lines, header, value):
> +    if lines and lines[0] and ':' not in lines[0]:
> +        lines.insert(0, '')
>      lines.insert(0, '%s: %s' % (header, value))
>      return lines
>
> diff --git a/tests/test-mq-header-date.t b/tests/test-mq-header-date.t
> --- a/tests/test-mq-header-date.t
> +++ b/tests/test-mq-header-date.t
> @@ -311,6 +311,7 @@
>    0: [mq]: 1.patch - test
>    ==== qref -d
>    Date: 9 0
> +
>    Four
>
>    diff -r ... 4
> @@ -494,6 +495,7 @@
>    ==== qref -u -d
>    Date: 15 0
>    From: john
> +
>    Nine
>
>    diff -r ... 9
> diff --git a/tests/test-mq-header-from.t b/tests/test-mq-header-from.t
> --- a/tests/test-mq-header-from.t
> +++ b/tests/test-mq-header-from.t
> @@ -250,6 +250,7 @@
>    0: [mq]: 1.patch - mary
>    ==== qref -u
>    From: jane
> +
>    Four
>
>    diff -r ... 4of
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Augie Fackler - Nov. 25, 2014, 3:45 p.m.
On Mon, Nov 17, 2014 at 01:52:31AM +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski@unity3d.com>
> # Date 1416185323 -3600
> #      Mon Nov 17 01:48:43 2014 +0100
> # Branch stable
> # Node ID 18220555396adc2bcbc7f3afa7542524f1bb151c
> # Parent  f8909f21ae9f3589cc60ab4f2629a446df921c31
> mq: when adding headers in plain mode, separate them from message (issue4453)

Scratch that, these are already pushed. Clearly I'm having a spot-on
morning with email.

>
> c87f2a5a6e49 did a clean-up in one direction ... but we want it in the other
> direction.
>
> diff --git a/hgext/mq.py b/hgext/mq.py
> --- a/hgext/mq.py
> +++ b/hgext/mq.py
> @@ -151,6 +151,8 @@ def inserthgheader(lines, header, value)
>      return lines
>
>  def insertplainheader(lines, header, value):
> +    if lines and lines[0] and ':' not in lines[0]:
> +        lines.insert(0, '')
>      lines.insert(0, '%s: %s' % (header, value))
>      return lines
>
> diff --git a/tests/test-mq-header-date.t b/tests/test-mq-header-date.t
> --- a/tests/test-mq-header-date.t
> +++ b/tests/test-mq-header-date.t
> @@ -311,6 +311,7 @@
>    0: [mq]: 1.patch - test
>    ==== qref -d
>    Date: 9 0
> +
>    Four
>
>    diff -r ... 4
> @@ -494,6 +495,7 @@
>    ==== qref -u -d
>    Date: 15 0
>    From: john
> +
>    Nine
>
>    diff -r ... 9
> diff --git a/tests/test-mq-header-from.t b/tests/test-mq-header-from.t
> --- a/tests/test-mq-header-from.t
> +++ b/tests/test-mq-header-from.t
> @@ -250,6 +250,7 @@
>    0: [mq]: 1.patch - mary
>    ==== qref -u
>    From: jane
> +
>    Four
>
>    diff -r ... 4of
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -151,6 +151,8 @@  def inserthgheader(lines, header, value)
     return lines
 
 def insertplainheader(lines, header, value):
+    if lines and lines[0] and ':' not in lines[0]:
+        lines.insert(0, '')
     lines.insert(0, '%s: %s' % (header, value))
     return lines
 
diff --git a/tests/test-mq-header-date.t b/tests/test-mq-header-date.t
--- a/tests/test-mq-header-date.t
+++ b/tests/test-mq-header-date.t
@@ -311,6 +311,7 @@ 
   0: [mq]: 1.patch - test
   ==== qref -d
   Date: 9 0
+  
   Four
   
   diff -r ... 4
@@ -494,6 +495,7 @@ 
   ==== qref -u -d
   Date: 15 0
   From: john
+  
   Nine
   
   diff -r ... 9
diff --git a/tests/test-mq-header-from.t b/tests/test-mq-header-from.t
--- a/tests/test-mq-header-from.t
+++ b/tests/test-mq-header-from.t
@@ -250,6 +250,7 @@ 
   0: [mq]: 1.patch - mary
   ==== qref -u
   From: jane
+  
   Four
   
   diff -r ... 4of