diff mercurial/exchange.py @ 45144:c93dd9d9f1e6

discovery: change users of `outgoing.missingheads` to `outgoing.ancestorsof` The attribute `missingheads` was recently renamed to `ancestorsof`, as it, despite the old name, doesn’t contain the missing heads but the changesets that were requested (including ancestors) for the outgoing operation. Changing all the users enables to print a warning if the old name is used. There is a good chance that some of the users are buggy because of the old name. Changing them to use the new name makes it more obvious that they are buggy. All users need to be reviewed for bugs. When sending patches for fixing them, the change will be more obvious without having to explain again and again the discrepancy of the old attribute name and what it actually contained.
author Manuel Jacob <me@manueljacob.de>
date Fri, 17 Jul 2020 09:20:48 +0200
parents b1e51ef4e536
children c26335fa4225
line wrap: on
line diff
--- a/mercurial/exchange.py	Wed Jul 15 11:38:54 2020 +0200
+++ b/mercurial/exchange.py	Fri Jul 17 09:20:48 2020 +0200
@@ -503,7 +503,7 @@
     @util.propertycache
     def futureheads(self):
         """future remote heads if the changeset push succeeds"""
-        return self.outgoing.missingheads
+        return self.outgoing.ancestorsof
 
     @util.propertycache
     def fallbackheads(self):
@@ -512,20 +512,20 @@
             # not target to push, all common are relevant
             return self.outgoing.commonheads
         unfi = self.repo.unfiltered()
-        # I want cheads = heads(::missingheads and ::commonheads)
-        # (missingheads is revs with secret changeset filtered out)
+        # I want cheads = heads(::ancestorsof and ::commonheads)
+        # (ancestorsof is revs with secret changeset filtered out)
         #
         # This can be expressed as:
-        #     cheads = ( (missingheads and ::commonheads)
-        #              + (commonheads and ::missingheads))"
+        #     cheads = ( (ancestorsof and ::commonheads)
+        #              + (commonheads and ::ancestorsof))"
         #              )
         #
         # while trying to push we already computed the following:
         #     common = (::commonheads)
-        #     missing = ((commonheads::missingheads) - commonheads)
+        #     missing = ((commonheads::ancestorsof) - commonheads)
         #
         # We can pick:
-        # * missingheads part of common (::commonheads)
+        # * ancestorsof part of common (::commonheads)
         common = self.outgoing.common
         rev = self.repo.changelog.index.rev
         cheads = [node for node in self.revs if rev(node) in common]
@@ -918,7 +918,7 @@
             # obsolete or unstable changeset in missing, at
             # least one of the missinghead will be obsolete or
             # unstable. So checking heads only is ok
-            for node in outgoing.missingheads:
+            for node in outgoing.ancestorsof:
                 ctx = unfi[node]
                 if ctx.obsolete():
                     raise error.Abort(mso % ctx)
@@ -969,7 +969,7 @@
     """
     # * 'force' do not check for push race,
     # * if we don't push anything, there are nothing to check.
-    if not pushop.force and pushop.outgoing.missingheads:
+    if not pushop.force and pushop.outgoing.ancestorsof:
         allowunrelated = b'related' in bundler.capabilities.get(
             b'checkheads', ()
         )