Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/context.py @ 52783:b3349f6cded9
annotate: fix ancestor check starting revision
This fixes the problem identified in a49d6f3c971b0f51e123ef3c01edad20e8770b11,
making hg annotate behave the same as rhg annotate.
author | Mitchell Kember <mkember@janestreet.com> |
---|---|
date | Mon, 10 Feb 2025 18:14:44 +0100 |
parents | a502f3f389b5 |
children |
comparison
equal
deleted
inserted
replaced
52782:a49d6f3c971b | 52783:b3349f6cded9 |
---|---|
1220 base = self.introfilectx() | 1220 base = self.introfilectx() |
1221 if getattr(base, '_ancestrycontext', None) is None: | 1221 if getattr(base, '_ancestrycontext', None) is None: |
1222 # it is safe to use an unfiltered repository here because we are | 1222 # it is safe to use an unfiltered repository here because we are |
1223 # walking ancestors only. | 1223 # walking ancestors only. |
1224 cl = self._repo.unfiltered().changelog | 1224 cl = self._repo.unfiltered().changelog |
1225 if base.rev() is None: | 1225 # use self.rev(), not base.rev(), because if self is a merge we should still |
1226 # consider linkrevs in the other branch as ancestors. | |
1227 if self.rev() is None: | |
1226 # wctx is not inclusive, but works because _ancestrycontext | 1228 # wctx is not inclusive, but works because _ancestrycontext |
1227 # is used to test filelog revisions | 1229 # is used to test filelog revisions |
1228 ac = cl.ancestors( | 1230 ac = cl.ancestors( |
1229 [p.rev() for p in base.parents()], inclusive=True | 1231 [p.rev() for p in self.parents()], inclusive=True |
1230 ) | 1232 ) |
1231 else: | 1233 else: |
1232 ac = cl.ancestors([base.rev()], inclusive=True) | 1234 ac = cl.ancestors([self.rev()], inclusive=True) |
1233 base._ancestrycontext = ac | 1235 base._ancestrycontext = ac |
1234 | 1236 |
1235 return dagop.annotate( | 1237 return dagop.annotate( |
1236 base, parents, skiprevs=skiprevs, diffopts=diffopts | 1238 base, parents, skiprevs=skiprevs, diffopts=diffopts |
1237 ) | 1239 ) |