changeset 28491:f57f7500a095

changelog: lazily parse user Same strategy as before. Revsets not accessing the user demonstrate a slight performance win: desc(bug) 0.887169 0.910400 0.895514 date(2015) 0.878797 0.870697 0.820987 extra(rebase_source) 0.865446 0.841644 0.823811 date(2015) or branch(default) 0.968276 0.945792 0.910981
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 06 Mar 2016 14:29:46 -0800
parents 959eadae589a
children 837f1c437d58
files mercurial/changelog.py
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changelog.py	Sun Mar 06 14:29:13 2016 -0800
+++ b/mercurial/changelog.py	Sun Mar 06 14:29:46 2016 -0800
@@ -156,7 +156,7 @@
         'extra',
         'files',
         '_rawmanifest',
-        'user',
+        '_rawuser',
     )
 
     def __new__(cls, text):
@@ -191,8 +191,10 @@
         nl1 = text.index('\n')
         self._rawmanifest = text[0:nl1]
 
+        nl2 = text.index('\n', nl1 + 1)
+        self._rawuser = text[nl1 + 1:nl2]
+
         l = text[:doublenl].split('\n')
-        self.user = encoding.tolocal(l[1])
 
         tdata = l[2].split(' ', 2)
         if len(tdata) != 3:
@@ -217,6 +219,10 @@
         return bin(self._rawmanifest)
 
     @property
+    def user(self):
+        return encoding.tolocal(self._rawuser)
+
+    @property
     def description(self):
         return encoding.tolocal(self._rawdesc)