diff mercurial/context.py @ 52769: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
line wrap: on
line diff
--- a/mercurial/context.py	Fri Feb 07 16:40:22 2025 -0500
+++ b/mercurial/context.py	Mon Feb 10 18:14:44 2025 +0100
@@ -1222,14 +1222,16 @@
             # it is safe to use an unfiltered repository here because we are
             # walking ancestors only.
             cl = self._repo.unfiltered().changelog
-            if base.rev() is None:
+            # use self.rev(), not base.rev(), because if self is a merge  we should still
+            # consider linkrevs in the other branch as ancestors.
+            if self.rev() is None:
                 # wctx is not inclusive, but works because _ancestrycontext
                 # is used to test filelog revisions
                 ac = cl.ancestors(
-                    [p.rev() for p in base.parents()], inclusive=True
+                    [p.rev() for p in self.parents()], inclusive=True
                 )
             else:
-                ac = cl.ancestors([base.rev()], inclusive=True)
+                ac = cl.ancestors([self.rev()], inclusive=True)
             base._ancestrycontext = ac
 
         return dagop.annotate(