hglib patch: fetch parents when doing hg log, et al.
alastair at alastairs-place.net
Mon Oct 29 12:09:11 CDT 2012
On 29 Oct 2012, at 15:52, Alastair Houghton <alastair at alastairs-place.net> wrote:
> Hi all,
> Please find attached a patch to python-hglib that makes the library fetch parent information automatically. This makes any iteration through the repository from the hglib client a *lot* quicker because it doesn't have to keep asking for the parent information separately.
> You can get the new information from the revision tuples by asking for the "parents" property; it's encoded as a list of tuples of type parentinfo, each of which has a rev and node property.
> I've also updated changectx to use this source for parent information, with the result that the parents property of a changectx will also be faster.
> I was careful to add the new property at the end of the revision tuple, so that existing code that accesses it by index shouldn't be affected.
> Kind regards,
> p.s. I'm not a member of the mercurial-devel mailing list, so any replies will need to be copied to me.
Oops... how embarrassing; I left a debug "print" statement in there. You'll want to do this:
---- cut here ----
# HG changeset patch
# User Alastair Houghton <alastair at coriolis-systems.com>
# Date 1351530394 0
# Node ID 61d19972cfc869d69ffb68789fa0767245854dc4
# Parent 82004922e30666bee6e437ad3ad5f73b750072bc
Removed extraneous print.
diff -r 82004922e306 -r 61d19972cfc8 hglib/client.py
--- a/hglib/client.py Mon Oct 29 15:44:49 2012 +0000
+++ b/hglib/client.py Mon Oct 29 17:06:34 2012 +0000
@@ -125,7 +125,6 @@
dt = datetime.datetime.fromtimestamp(posixtime)
# split the parents argument and make it into a list
parents = rev.strip()
- print parents
parents = [parentinfo(p.split(':')) for p in parents.split(' ')]
---- cut here ----
:-) Sorry about that.
More information about the Mercurial-devel