Mercurial > hg-stable
changeset 23345:83cbf556babf stable
mq: introduce insertplainheader - same naive implementation as before
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 17 Nov 2014 01:48:19 +0100 |
parents | 6333412245ec |
children | 5ccced6eab0b |
files | hgext/mq.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Sun Nov 16 19:57:40 2014 +0100 +++ b/hgext/mq.py Mon Nov 17 01:48:19 2014 +0100 @@ -150,6 +150,10 @@ 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 @@ 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 @@ 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