changeset 1536:8ca9f5b17257

minor optimization: save some string trash
author twaldmann@thinkmo.de
date Mon, 14 Nov 2005 02:30:19 +0200
parents 7ae0ce7a3dc4
children bf4e7ef08741
files mercurial/filelog.py mercurial/mdiff.py
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filelog.py	Fri Nov 11 18:20:24 2005 -0800
+++ b/mercurial/filelog.py	Mon Nov 14 02:30:19 2005 +0200
@@ -54,7 +54,7 @@
             mt = ""
             if meta:
                 mt = [ "%s: %s\n" % (k, v) for k,v in meta.items() ]
-            text = "\1\n" + "".join(mt) + "\1\n" + text
+            text = "\1\n%s\1\n%s" % ("".join(mt), text)
         return self.addrevision(text, transaction, link, p1, p2)
 
     def renamed(self, node):
--- a/mercurial/mdiff.py	Fri Nov 11 18:20:24 2005 -0800
+++ b/mercurial/mdiff.py	Mon Nov 14 02:30:19 2005 +0200
@@ -32,8 +32,8 @@
         l = list(difflib.unified_diff(a, b, "a/" + fn, "b/" + fn))
         if not l: return ""
         # difflib uses a space, rather than a tab
-        l[0] = l[0][:-2] + "\t" + ad + "\n"
-        l[1] = l[1][:-2] + "\t" + bd + "\n"
+        l[0] = "%s\t%s\n" % (l[0][:-2], ad)
+        l[1] = "%s\t%s\n" % (l[1][:-2], bd)
 
     for ln in xrange(len(l)):
         if l[ln][-1] != '\n':