# HG changeset patch # User Mads Kiilerich # Date 2014-11-16 18:57:40 # Node ID 6333412245ec7d4eafc928d933ca7a03884b918c # Parent 3246801ff3135322544f804c2b081f4da2e39646 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. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -293,7 +293,10 @@ class patchheader(object): 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. 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 @@ -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 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 @@ -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