Mercurial > hg-stable
changeset 28493:7796473c11b3
changelog: lazily parse files
More of the same.
Again, modest revset performance wins:
author(mpm)
0.896565
0.822961
0.805156
desc(bug)
0.887169
0.847054
0.798101
date(2015)
0.878797
0.811613
0.786689
extra(rebase_source)
0.865446
0.797756
0.777408
author(mpm) or author(greg)
1.801832
1.668172
1.626547
author(mpm) or desc(bug)
1.812438
1.677608
1.613941
date(2015) or branch(default)
0.968276
0.896032
0.869017
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 06 Mar 2016 14:31:06 -0800 |
parents | 837f1c437d58 |
children | 63653147e9bb |
files | mercurial/changelog.py |
diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Sun Mar 06 14:30:25 2016 -0800 +++ b/mercurial/changelog.py Sun Mar 06 14:31:06 2016 -0800 @@ -153,7 +153,7 @@ __slots__ = ( '_rawdateextra', '_rawdesc', - 'files', + '_rawfiles', '_rawmanifest', '_rawuser', ) @@ -196,8 +196,12 @@ nl3 = text.index('\n', nl2 + 1) self._rawdateextra = text[nl2 + 1:nl3] - l = text[:doublenl].split('\n') - self.files = l[3:] + # The list of files may be empty. Which means nl3 is the first of the + # double newline that precedes the description. + if nl3 == doublenl: + self._rawfiles = None + else: + self._rawfiles = text[nl3 + 1:doublenl] return self @@ -242,6 +246,13 @@ return decodeextra(raw) @property + def files(self): + if self._rawfiles is None: + return [] + + return self._rawfiles.split('\n') + + @property def description(self): return encoding.tolocal(self._rawdesc)