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