minor optimization: save some string trash
authortwaldmann@thinkmo.de
Mon, 14 Nov 2005 02:30:19 +0200
changeset 1540 8ca9f5b17257
parent 1535 7ae0ce7a3dc4
child 1541 bf4e7ef08741
minor optimization: save some string trash
mercurial/filelog.py
mercurial/mdiff.py
--- 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':