Mercurial > public > mercurial-scm > hg
comparison mercurial/context.py @ 24818:8d7d0bf62f9f stable
annotate: prepare ancestry context of workingfilectx
_ancestrycontext is necessary for fast lookup of _changeid. Because we can't
compute the ancestors from wctx, we skip to its parents. 'None' is not needed
to be included in _ancestrycontext because it is used for a membership test
of filelog revisions.
repo: https://hg.mozilla.org/releases/mozilla-beta/#062e49bcb2da
command: hg annotate -r 'wdir()' gfx/thebes/gfxWindowsPlatform.cpp
before: 51.520 sec
after: 1.780 sec
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 18 Apr 2015 15:27:03 +0900 |
parents | 0bb98eee531d |
children | c82d88dfaf59 |
comparison
equal
deleted
inserted
replaced
24817:0bb98eee531d | 24818:8d7d0bf62f9f |
---|---|
904 # use linkrev to find the first changeset where self appeared | 904 # use linkrev to find the first changeset where self appeared |
905 base = self | 905 base = self |
906 introrev = self.introrev() | 906 introrev = self.introrev() |
907 if self.rev() != introrev: | 907 if self.rev() != introrev: |
908 base = self.filectx(self.filenode(), changeid=introrev) | 908 base = self.filectx(self.filenode(), changeid=introrev) |
909 if introrev and getattr(base, '_ancestrycontext', None) is None: | 909 if getattr(base, '_ancestrycontext', None) is None: |
910 ac = self._repo.changelog.ancestors([introrev], inclusive=True) | 910 cl = self._repo.changelog |
911 if introrev is None: | |
912 # wctx is not inclusive, but works because _ancestrycontext | |
913 # is used to test filelog revisions | |
914 ac = cl.ancestors([p.rev() for p in base.parents()], | |
915 inclusive=True) | |
916 else: | |
917 ac = cl.ancestors([introrev], inclusive=True) | |
911 base._ancestrycontext = ac | 918 base._ancestrycontext = ac |
912 | 919 |
913 # This algorithm would prefer to be recursive, but Python is a | 920 # This algorithm would prefer to be recursive, but Python is a |
914 # bit recursion-hostile. Instead we do an iterative | 921 # bit recursion-hostile. Instead we do an iterative |
915 # depth-first search. | 922 # depth-first search. |