Patchwork [2,of,3,stable] mq: introduce insertplainheader - same naive implementation as before

login
register
mail settings
Submitter Mads Kiilerich
Date Nov. 17, 2014, 12:52 a.m.
Message ID <f8909f21ae9f3589cc60.1416185550@localhost.localdomain>
Download mbox | patch
Permalink /patch/6765/
State Accepted
Commit 83cbf556babf1e5484fda6708eef34497d567a36
Headers show

Comments

Mads Kiilerich - Nov. 17, 2014, 12:52 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# 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

Patch

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