Mercurial > public > mercurial-scm > hg
comparison mercurial/changelog.py @ 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 | d698c11bd189 |
children | 86de91c56355 |
comparison
equal
deleted
inserted
replaced
28305:f5ae291dfedf | 28306:1778770e1982 |
---|---|
332 : older versions ignore it | 332 : older versions ignore it |
333 files\n\n : files modified by the cset, no \n or \r allowed | 333 files\n\n : files modified by the cset, no \n or \r allowed |
334 (.*) : comment (free text, ideally utf-8) | 334 (.*) : comment (free text, ideally utf-8) |
335 | 335 |
336 changelog v0 doesn't use extra | 336 changelog v0 doesn't use extra |
337 | |
338 Returns a 6-tuple consisting of the following: | |
339 - manifest node (binary) | |
340 - user (encoding.localstr) | |
341 - (time, timezone) 2-tuple of a float and int offset | |
342 - list of files modified by the cset | |
343 - commit message / description (binary) | |
344 - dict of extra entries | |
337 """ | 345 """ |
338 text = self.revision(node) | 346 text = self.revision(node) |
339 if not text: | 347 if not text: |
340 return nullid, "", (0, 0), [], "", _defaultextra | 348 return nullid, "", (0, 0), [], "", _defaultextra |
341 last = text.index("\n\n") | 349 last = text.index("\n\n") |
342 desc = encoding.tolocal(text[last + 2:]) | 350 desc = text[last + 2:] |
343 l = text[:last].split('\n') | 351 l = text[:last].split('\n') |
344 manifest = bin(l[0]) | 352 manifest = bin(l[0]) |
345 user = encoding.tolocal(l[1]) | 353 user = encoding.tolocal(l[1]) |
346 | 354 |
347 tdata = l[2].split(' ', 2) | 355 tdata = l[2].split(' ', 2) |