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
--- 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)