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