Show More
@@ -946,6 +946,14 b' class basefilectx(object):' | |||
|
946 | 946 | return self.linkrev() |
|
947 | 947 | return self._adjustlinkrev(self.rev(), inclusive=True) |
|
948 | 948 | |
|
949 | def introfilectx(self): | |
|
950 | """Return filectx having identical contents, but pointing to the | |
|
951 | changeset revision where this filectx was introduced""" | |
|
952 | introrev = self.introrev() | |
|
953 | if self.rev() == introrev: | |
|
954 | return self | |
|
955 | return self.filectx(self.filenode(), changeid=introrev) | |
|
956 | ||
|
949 | 957 | def _parentfilectx(self, path, fileid, filelog): |
|
950 | 958 | """create parent filectx keeping ancestry info for _adjustlinkrev()""" |
|
951 | 959 | fctx = filectx(self._repo, path, fileid=fileid, filelog=filelog) |
@@ -1036,19 +1044,16 b' class basefilectx(object):' | |||
|
1036 | 1044 | return pl |
|
1037 | 1045 | |
|
1038 | 1046 | # use linkrev to find the first changeset where self appeared |
|
1039 | base = self | |
|
1040 | introrev = self.introrev() | |
|
1041 | if self.rev() != introrev: | |
|
1042 | base = self.filectx(self.filenode(), changeid=introrev) | |
|
1047 | base = self.introfilectx() | |
|
1043 | 1048 | if getattr(base, '_ancestrycontext', None) is None: |
|
1044 | 1049 | cl = self._repo.changelog |
|
1045 |
if |
|
|
1050 | if base.rev() is None: | |
|
1046 | 1051 | # wctx is not inclusive, but works because _ancestrycontext |
|
1047 | 1052 | # is used to test filelog revisions |
|
1048 | 1053 | ac = cl.ancestors([p.rev() for p in base.parents()], |
|
1049 | 1054 | inclusive=True) |
|
1050 | 1055 | else: |
|
1051 |
ac = cl.ancestors([ |
|
|
1056 | ac = cl.ancestors([base.rev()], inclusive=True) | |
|
1052 | 1057 | base._ancestrycontext = ac |
|
1053 | 1058 | |
|
1054 | 1059 | # This algorithm would prefer to be recursive, but Python is a |
@@ -268,9 +268,7 b' def blockancestors(fctx, fromline, tolin' | |||
|
268 | 268 | `fromline`-`toline` range. |
|
269 | 269 | """ |
|
270 | 270 | diffopts = patch.diffopts(fctx._repo.ui) |
|
271 |
|
|
|
272 | if fctx.rev() != introrev: | |
|
273 | fctx = fctx.filectx(fctx.filenode(), changeid=introrev) | |
|
271 | fctx = fctx.introfilectx() | |
|
274 | 272 | visit = {(fctx.linkrev(), fctx.filenode()): (fctx, (fromline, toline))} |
|
275 | 273 | while visit: |
|
276 | 274 | c, linerange2 = visit.pop(max(visit)) |
General Comments 0
You need to be logged in to leave comments.
Login now