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. |