Mercurial > hg
changeset 28306:1778770e1982
changelog: lazy decode description (API)
Currently, changelog reading decodes read values. This is wasteful
because a lot of times consumers aren't interested in some of these
values.
This patch changes description decoding to occur in changectx as
needed.
revsets reading changelog entries appear to speed up slightly:
revset #7: author(lmoscovicz)
plain
0) 0.906329
1) 0.872653
revset #8: author(mpm)
plain
0) 0.903478
1) 0.878037
revset #9: author(lmoscovicz) or author(mpm)
plain
0) 1.817855
1) 1.778680
revset #10: author(mpm) or author(lmoscovicz)
plain
0) 1.837052
1) 1.764568
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 27 Feb 2016 22:25:14 -0800 |
parents | f5ae291dfedf |
children | 86de91c56355 |
files | mercurial/changelog.py mercurial/context.py |
diffstat | 2 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Thu Feb 11 19:38:26 2016 +0000 +++ b/mercurial/changelog.py Sat Feb 27 22:25:14 2016 -0800 @@ -334,12 +334,20 @@ (.*) : comment (free text, ideally utf-8) changelog v0 doesn't use extra + + Returns a 6-tuple consisting of the following: + - manifest node (binary) + - user (encoding.localstr) + - (time, timezone) 2-tuple of a float and int offset + - list of files modified by the cset + - commit message / description (binary) + - dict of extra entries """ text = self.revision(node) if not text: return nullid, "", (0, 0), [], "", _defaultextra last = text.index("\n\n") - desc = encoding.tolocal(text[last + 2:]) + desc = text[last + 2:] l = text[:last].split('\n') manifest = bin(l[0]) user = encoding.tolocal(l[1])
--- a/mercurial/context.py Thu Feb 11 19:38:26 2016 +0000 +++ b/mercurial/context.py Sat Feb 27 22:25:14 2016 -0800 @@ -554,7 +554,7 @@ def files(self): return self._changeset[3] def description(self): - return self._changeset[4] + return encoding.tolocal(self._changeset[4]) def branch(self): return encoding.tolocal(self._changeset[5].get("branch")) def closesbranch(self):