changeset 23346:5ccced6eab0b stable

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.
author Mads Kiilerich <madski@unity3d.com>
date Mon, 17 Nov 2014 01:48:43 +0100
parents 83cbf556babf
children e63941631a3f 2e65da5f80df
files hgext/mq.py tests/test-mq-header-date.t tests/test-mq-header-from.t
diffstat 3 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Nov 17 01:48:19 2014 +0100
+++ b/hgext/mq.py	Mon Nov 17 01:48:43 2014 +0100
@@ -151,6 +151,8 @@
     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
 
--- a/tests/test-mq-header-date.t	Mon Nov 17 01:48:19 2014 +0100
+++ b/tests/test-mq-header-date.t	Mon Nov 17 01:48:43 2014 +0100
@@ -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
--- a/tests/test-mq-header-from.t	Mon Nov 17 01:48:19 2014 +0100
+++ b/tests/test-mq-header-from.t	Mon Nov 17 01:48:43 2014 +0100
@@ -250,6 +250,7 @@
   0: [mq]: 1.patch - mary
   ==== qref -u
   From: jane
+  
   Four
   
   diff -r ... 4of