mercurial/discovery.py
changeset 45144 c93dd9d9f1e6
parent 45143 5631b0116374
child 45908 122f0b59f5f0
--- a/mercurial/discovery.py	Wed Jul 15 11:38:54 2020 +0200
+++ b/mercurial/discovery.py	Fri Jul 17 09:20:48 2020 +0200
@@ -93,20 +93,17 @@
       excluded is the list of missing changeset that shouldn't be sent
       remotely.
 
-      missingheads is an alias to ancestorsof, but the name is wrong and it
-      will be removed
-
     Some members are computed on demand from the heads, unless provided upfront
     by discovery.'''
 
     def __init__(
-        self, repo, commonheads=None, missingheads=None, missingroots=None
+        self, repo, commonheads=None, ancestorsof=None, missingroots=None
     ):
         # at least one of them must not be set
         assert None in (commonheads, missingroots)
         cl = repo.changelog
-        if missingheads is None:
-            missingheads = cl.heads()
+        if ancestorsof is None:
+            ancestorsof = cl.heads()
         if missingroots:
             discbases = []
             for n in missingroots:
@@ -114,14 +111,14 @@
             # TODO remove call to nodesbetween.
             # TODO populate attributes on outgoing instance instead of setting
             # discbases.
-            csets, roots, heads = cl.nodesbetween(missingroots, missingheads)
+            csets, roots, heads = cl.nodesbetween(missingroots, ancestorsof)
             included = set(csets)
-            missingheads = heads
+            ancestorsof = heads
             commonheads = [n for n in discbases if n not in included]
         elif not commonheads:
             commonheads = [nullid]
         self.commonheads = commonheads
-        self.missingheads = missingheads
+        self.ancestorsof = ancestorsof
         self._revlog = cl
         self._common = None
         self._missing = None
@@ -129,7 +126,7 @@
 
     def _computecommonmissing(self):
         sets = self._revlog.findcommonmissing(
-            self.commonheads, self.missingheads
+            self.commonheads, self.ancestorsof
         )
         self._common, self._missing = sets
 
@@ -146,8 +143,15 @@
         return self._missing
 
     @property
-    def ancestorsof(self):
-        return self.missingheads
+    def missingheads(self):
+        util.nouideprecwarn(
+            b'outgoing.missingheads never contained what the name suggests and '
+            b'was renamed to outgoing.ancestorsof. check your code for '
+            b'correctness.',
+            b'5.5',
+            stacklevel=2,
+        )
+        return self.ancestorsof
 
 
 def findcommonoutgoing(
@@ -163,7 +167,7 @@
     If commoninc is given, it must be the result of a prior call to
     findcommonincoming(repo, other, force) to avoid recomputing it here.
 
-    If portable is given, compute more conservative common and missingheads,
+    If portable is given, compute more conservative common and ancestorsof,
     to make bundles created from the instance more portable.'''
     # declare an empty outgoing object to be filled later
     og = outgoing(repo, None, None)
@@ -178,10 +182,10 @@
     # compute outgoing
     mayexclude = repo._phasecache.phaseroots[phases.secret] or repo.obsstore
     if not mayexclude:
-        og.missingheads = onlyheads or repo.heads()
+        og.ancestorsof = onlyheads or repo.heads()
     elif onlyheads is None:
         # use visible heads as it should be cached
-        og.missingheads = repo.filtered(b"served").heads()
+        og.ancestorsof = repo.filtered(b"served").heads()
         og.excluded = [ctx.node() for ctx in repo.set(b'secret() or extinct()')]
     else:
         # compute common, missing and exclude secret stuff
@@ -196,12 +200,12 @@
             else:
                 missing.append(node)
         if len(missing) == len(allmissing):
-            missingheads = onlyheads
+            ancestorsof = onlyheads
         else:  # update missing heads
-            missingheads = phases.newheads(repo, onlyheads, excluded)
-        og.missingheads = missingheads
+            ancestorsof = phases.newheads(repo, onlyheads, excluded)
+        og.ancestorsof = ancestorsof
     if portable:
-        # recompute common and missingheads as if -r<rev> had been given for
+        # recompute common and ancestorsof as if -r<rev> had been given for
         # each head of missing, and --base <rev> for each head of the proper
         # ancestors of missing
         og._computecommonmissing()
@@ -209,7 +213,7 @@
         missingrevs = {cl.rev(n) for n in og._missing}
         og._common = set(cl.ancestors(missingrevs)) - missingrevs
         commonheads = set(og.commonheads)
-        og.missingheads = [h for h in og.missingheads if h not in commonheads]
+        og.ancestorsof = [h for h in og.ancestorsof if h not in commonheads]
 
     return og
 
@@ -282,7 +286,7 @@
     # If there are no obsstore, no post processing are needed.
     if repo.obsstore:
         torev = repo.changelog.rev
-        futureheads = {torev(h) for h in outgoing.missingheads}
+        futureheads = {torev(h) for h in outgoing.ancestorsof}
         futureheads |= {torev(h) for h in outgoing.commonheads}
         allfuturecommon = repo.changelog.ancestors(futureheads, inclusive=True)
         for branch, heads in sorted(pycompat.iteritems(headssum)):