[PATCH STABLE V2] hgweb: cache fctx.parents() in annotate command (issue5414)

Jun Wu quark at fb.com
Sun Nov 6 12:01:05 EST 2016


Excerpts from Yuya Nishihara's message of 2016-11-06 11:31:04 +0900:
> Perhaps fctx.parents() can be property-cached, but we'll need to drop
> uninteresting chains of parents in fctx.annotate().

If we go the property-cache approach, I think it's better to cache
"_adjustedlinkrev". It's at a lower level and covers both "parents"
and "introrev". Caching "parents" may increase memory usage unintentionally.

I don't fully get what "uninteresting chains of parents" means here.
In the annotate case, let's say f1, f2 = f0.parents().
Both f1 and f2 have _descendantrev set to f0's adjusted linkrev.

Suppose there is a global cache dict: {(path, filenode, srcrev): linkrev}, I
think if srcrev=_descendantrev (it's true for f1, f2) and _descendantrev is
adjusted from the direct child (f0), then it is "interesting" and can be
cached. This is similar to what marmoute said during the sprint - for the
log -f or annotate case, once the first fctx's introrev is known, the cache
can be used to calculate the ancestors' adjusted linkrevs.


More information about the Mercurial-devel mailing list