[PATCH 3 of 6] obsolete: populate successors(), precursors(), children() lazily

Martin von Zweigbergk martinvonz at google.com
Thu Feb 5 00:50:08 CST 2015


On Wed Feb 04 2015 at 4:06:36 PM Matt Mackall <mpm at selenic.com> wrote:

> On Tue, 2015-02-03 at 20:01 -0800, Martin von Zweigbergk wrote:
> > # HG changeset patch
> > # User Martin von Zweigbergk <martinvonz at google.com>
> > # Date 1421822097 28800
> > #      Tue Jan 20 22:34:57 2015 -0800
> > # Node ID cd65758885ab3cc6649001fa9aa68105d818323a
> > # Parent  518d3caf2307a7699ec078afe9b1e6991640941c
> > obsolete: populate successors(), precursors(), children() lazily
>
> >      def successors(self):
> > +        if self._successors is None:
> > +            self._successors = {}
> > +            self._addsuccessors(self._all)
> >          return self._successors
>
> You probably want to look at how util.propertycache is used to make a
> faster version of this pattern.


Thanks. I'm not sure "faster" is important here, but it does seem to
simplify as well. I'll send V2 of patches 1/6-3/6 soon, with patch 2
replaced because it's no longer need with @propertycache.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20150205/d7e32ccf/attachment.html>


More information about the Mercurial-devel mailing list