diff mercurial/changelog.py @ 28490:959eadae589a

changelog: lazily parse manifest node Like the description, we store the raw bytes and convert from hex on access. This patch also marks the beginning of our new parsing method, which is based on newline offsets and doesn't rely on str.split(). Many revsets showed a performance improvement: author(mpm) 0.896565 0.869085 0.868598 desc(bug) 0.887169 0.928164 0.910400 extra(rebase_source) 0.865446 0.871500 0.841644 author(mpm) or author(greg) 1.801832 1.791589 1.731503 author(mpm) or desc(bug) 1.812438 1.851003 1.798764 date(2015) or branch(default) 0.968276 0.974027 0.945792
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Mar 2016 14:29:13 -0800
parents 8939a95064f1
children f57f7500a095
line wrap: on
line diff
--- a/mercurial/changelog.py	Sun Mar 06 14:28:46 2016 -0800
+++ b/mercurial/changelog.py	Sun Mar 06 14:29:13 2016 -0800
@@ -155,7 +155,7 @@
         '_rawdesc',
         'extra',
         'files',
-        'manifest',
+        '_rawmanifest',
         'user',
     )
 
@@ -188,8 +188,10 @@
         doublenl = text.index('\n\n')
         self._rawdesc = text[doublenl + 2:]
 
+        nl1 = text.index('\n')
+        self._rawmanifest = text[0:nl1]
+
         l = text[:doublenl].split('\n')
-        self.manifest = bin(l[0])
         self.user = encoding.tolocal(l[1])
 
         tdata = l[2].split(' ', 2)
@@ -211,6 +213,10 @@
         return self
 
     @property
+    def manifest(self):
+        return bin(self._rawmanifest)
+
+    @property
     def description(self):
         return encoding.tolocal(self._rawdesc)