diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -466,7 +466,7 @@ def _rebundle(bundlerepo, bundleroots, u version = b'02' outgoing = discovery.outgoing( - bundlerepo, commonheads=bundleroots, missingheads=[unknownhead] + bundlerepo, commonheads=bundleroots, ancestorsof=[unknownhead] ) cgstream = changegroup.makestream(bundlerepo, outgoing, version, b'pull') cgstream = util.chunkbuffer(cgstream).read() diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1711,7 +1711,7 @@ def _addpartsfromopts(ui, repo, bundler, b'nbchanges', b'%d' % cg.extras[b'clcount'], mandatory=False ) if opts.get(b'phases') and repo.revs( - b'%ln and secret()', outgoing.missingheads + b'%ln and secret()', outgoing.ancestorsof ): part.addparam( b'targetphase', b'%d' % phases.secret, mandatory=False @@ -1753,7 +1753,7 @@ def addparttagsfnodescache(repo, bundler # consume little memory (1M heads is 40MB) b) we don't want to send the # part if we don't have entries and knowing if we have entries requires # cache lookups. - for node in outgoing.missingheads: + for node in outgoing.ancestorsof: # Don't compute missing, as this may slow down serving. fnode = cache.getfnode(node, computemissing=False) if fnode is not None: diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1629,7 +1629,7 @@ def makestream( repo = repo.unfiltered() commonrevs = outgoing.common csets = outgoing.missing - heads = outgoing.missingheads + heads = outgoing.ancestorsof # We go through the fast path if we get told to, or if all (unfiltered # heads have been requested (since we then know there all linkrevs will # be pulled by the client). diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -93,20 +93,17 @@ class outgoing(object): 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 @@ class outgoing(object): # 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 @@ class outgoing(object): def _computecommonmissing(self): sets = self._revlog.findcommonmissing( - self.commonheads, self.missingheads + self.commonheads, self.ancestorsof ) self._common, self._missing = sets @@ -146,8 +143,15 @@ class outgoing(object): 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 @@ def findcommonoutgoing( 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 @@ def findcommonoutgoing( # 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 @@ def findcommonoutgoing( 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 had been given for + # recompute common and ancestorsof as if -r had been given for # each head of missing, and --base for each head of the proper # ancestors of missing og._computecommonmissing() @@ -209,7 +213,7 @@ def findcommonoutgoing( 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 @@ def _headssummary(pushop): # 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)): diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -503,7 +503,7 @@ class pushoperation(object): @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 @@ class pushoperation(object): # 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 @@ def _pushcheckoutgoing(pushop): # 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 @@ def _pushb2ctxcheckheads(pushop, bundler """ # * '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', () ) diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -412,13 +412,13 @@ class locallegacypeer(localpeer): def changegroup(self, nodes, source): outgoing = discovery.outgoing( - self._repo, missingroots=nodes, missingheads=self._repo.heads() + self._repo, missingroots=nodes, ancestorsof=self._repo.heads() ) return changegroup.makechangegroup(self._repo, outgoing, b'01', source) def changegroupsubset(self, bases, heads, source): outgoing = discovery.outgoing( - self._repo, missingroots=bases, missingheads=heads + self._repo, missingroots=bases, ancestorsof=heads ) return changegroup.makechangegroup(self._repo, outgoing, b'01', source) diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -66,7 +66,7 @@ def backupbundle( else: bundletype = b"HG10UN" - outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads) + outgoing = discovery.outgoing(repo, missingroots=bases, ancestorsof=heads) contentopts = { b'cg.version': cgversion, b'obsolescence': obsolescence, diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -162,7 +162,7 @@ class shelvedfile(object): repo = self.repo.unfiltered() outgoing = discovery.outgoing( - repo, missingroots=bases, missingheads=[node] + repo, missingroots=bases, ancestorsof=[node] ) cg = changegroup.makechangegroup(repo, outgoing, cgversion, b'shelve') diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py +++ b/mercurial/wireprotov1server.py @@ -339,7 +339,7 @@ def capabilities(repo, proto): def changegroup(repo, proto, roots): nodes = wireprototypes.decodelist(roots) outgoing = discovery.outgoing( - repo, missingroots=nodes, missingheads=repo.heads() + repo, missingroots=nodes, ancestorsof=repo.heads() ) cg = changegroupmod.makechangegroup(repo, outgoing, b'01', b'serve') gen = iter(lambda: cg.read(32768), b'') @@ -350,7 +350,7 @@ def changegroup(repo, proto, roots): def changegroupsubset(repo, proto, bases, heads): bases = wireprototypes.decodelist(bases) heads = wireprototypes.decodelist(heads) - outgoing = discovery.outgoing(repo, missingroots=bases, missingheads=heads) + outgoing = discovery.outgoing(repo, missingroots=bases, ancestorsof=heads) cg = changegroupmod.makechangegroup(repo, outgoing, b'01', b'serve') gen = iter(lambda: cg.read(32768), b'') return wireprototypes.streamres(gen=gen)