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