Patchwork [STABLE] annotate: always prepare ancestry context of base fctx (issue4600)

login
register
mail settings
Submitter Yuya Nishihara
Date April 16, 2015, 2:13 p.m.
Message ID <fba3dfd79fd4d763c7cf.1429193584@mimosa>
Download mbox | patch
Permalink /patch/8713/
State Accepted
Headers show

Comments

Yuya Nishihara - April 16, 2015, 2:13 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1429191233 -32400
#      Thu Apr 16 22:33:53 2015 +0900
# Branch stable
# Node ID fba3dfd79fd4d763c7cf6eb2e94e20da4e158eec
# Parent  1784ca1483921babd792932d1e4575fda1c3359e
annotate: always prepare ancestry context of base fctx (issue4600)

This patch extends the workaround introduced by dd01834a696f. Even if the
base fctx is the same as intorrev, _ancestrycontext must be built for faster
_changeid lookup.

repo:    https://hg.mozilla.org/releases/mozilla-beta
command: hg annotate -r 4954faa47dd0 gfx/thebes/gfxWindowsPlatform.cpp
before:  52.450 sec
after:    1.820 sec
Pierre-Yves David - April 16, 2015, 3:58 p.m.
On 04/16/2015 10:13 AM, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1429191233 -32400
> #      Thu Apr 16 22:33:53 2015 +0900
> # Branch stable
> # Node ID fba3dfd79fd4d763c7cf6eb2e94e20da4e158eec
> # Parent  1784ca1483921babd792932d1e4575fda1c3359e
> annotate: always prepare ancestry context of base fctx (issue4600)

Good catch. Pushed to the clowncopter. Thanks.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -919,6 +919,7 @@  class basefilectx(object):
         introrev = self.introrev()
         if self.rev() != introrev:
             base = self.filectx(self.filenode(), changeid=introrev)
+        if getattr(base, '_ancestrycontext', None) is None:
             ac = self._repo.changelog.ancestors([introrev], inclusive=True)
             base._ancestrycontext = ac