From patchwork Mon Nov 17 00:52:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2, of, 3, stable] mq: introduce insertplainheader - same naive implementation as before From: Mads Kiilerich X-Patchwork-Id: 6765 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 17 Nov 2014 01:52:30 +0100 # HG changeset patch # User Mads Kiilerich # Date 1416185299 -3600 # Mon Nov 17 01:48:19 2014 +0100 # Branch stable # Node ID f8909f21ae9f3589cc60ab4f2629a446df921c31 # Parent 69da71d3e1f73391492f90b36cf6ea855af184bf mq: introduce insertplainheader - same naive implementation as before diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -150,6 +150,10 @@ def inserthgheader(lines, header, value) lines.append(header + value) return lines +def insertplainheader(lines, header, value): + lines.insert(0, '%s: %s' % (header, value)) + return lines + class patchheader(object): def __init__(self, pf, plainmode=False): def eatdiff(lines): @@ -260,7 +264,7 @@ class patchheader(object): inserthgheader(self.comments, '# User ', user) except ValueError: if self.plainmode: - self.comments = ['From: ' + user] + self.comments + insertplainheader(self.comments, 'From', user) else: tmp = ['# HG changeset patch', '# User ' + user] self.comments = tmp + self.comments @@ -272,7 +276,7 @@ class patchheader(object): inserthgheader(self.comments, '# Date ', date) except ValueError: if self.plainmode: - self.comments = ['Date: ' + date] + self.comments + insertplainheader(self.comments, 'Date', date) else: tmp = ['# HG changeset patch', '# Date ' + date] self.comments = tmp + self.comments