changeset 23344:6333412245ec stable

mq: when setting message in plain mode, separate it from header (issue4453) Fix inconsistent handling of plain header separation in mq patcheader - and contrary to c87f2a5a6e49, do it in the direction of having an empty line between header and description. Plain patches are like mails and should thus have an empty line between headers and body in compliance with RFC 822 3.1.
author Mads Kiilerich <madski@unity3d.com>
date Sun, 16 Nov 2014 19:57:40 +0100
parents 3246801ff313
children 83cbf556babf
files hgext/mq.py tests/test-mq-header-date.t tests/test-mq-header-from.t
diffstat 3 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Nov 11 17:25:09 2014 -0600
+++ b/hgext/mq.py	Sun Nov 16 19:57:40 2014 +0100
@@ -293,7 +293,10 @@
         if self.comments:
             self._delmsg()
         self.message = [message]
-        self.comments += self.message
+        if message:
+            if self.plainmode and self.comments and self.comments[-1]:
+                self.comments.append('')
+            self.comments.append(message)
 
     def updateheader(self, prefixes, new):
         '''Update all references to a field in the patch header.
--- a/tests/test-mq-header-date.t	Tue Nov 11 17:25:09 2014 -0600
+++ b/tests/test-mq-header-date.t	Sun Nov 16 19:57:40 2014 +0100
@@ -243,6 +243,7 @@
   now at: 1.patch
   ==== qnew -d -m
   Date: 6 0
+  
   Three
   
   1: Three - test - 6.00
@@ -250,6 +251,7 @@
   ==== qref
   adding 3
   Date: 6 0
+  
   Three
   
   diff -r ... 3
@@ -261,6 +263,7 @@
   0: [mq]: 1.patch - test - 4.00
   ==== qref -m
   Date: 6 0
+  
   Drei
   
   diff -r ... 3
@@ -272,6 +275,7 @@
   0: [mq]: 1.patch - test - 4.00
   ==== qref -d
   Date: 7 0
+  
   Drei
   
   diff -r ... 3
@@ -283,6 +287,7 @@
   0: [mq]: 1.patch - test - 4.00
   ==== qref -d -m
   Date: 8 0
+  
   Three (again)
   
   diff -r ... 3
--- a/tests/test-mq-header-from.t	Tue Nov 11 17:25:09 2014 -0600
+++ b/tests/test-mq-header-from.t	Sun Nov 16 19:57:40 2014 +0100
@@ -176,6 +176,7 @@
   0: [mq]: 1.patch - mary
   ==== qnew -U -m
   From: test
+  
   Three
   
   2: Three - test
@@ -184,6 +185,7 @@
   ==== qref
   adding 3
   From: test
+  
   Three
   
   diff -r ... 3
@@ -196,6 +198,7 @@
   0: [mq]: 1.patch - mary
   ==== qref -m
   From: test
+  
   Drei
   
   diff -r ... 3
@@ -208,6 +211,7 @@
   0: [mq]: 1.patch - mary
   ==== qref -u
   From: mary
+  
   Drei
   
   diff -r ... 3
@@ -220,6 +224,7 @@
   0: [mq]: 1.patch - mary
   ==== qref -u -m
   From: maria
+  
   Three (again)
   
   diff -r ... 3