# HG changeset patch # User Pulkit Goyal # Date 2018-09-29 22:15:51 # Node ID a24f4638d6c11525291590dfcd6be0c621f9763f # Parent d5498db5f86a7f151176d0a2a02f76f2d8a19e59 narrow: move the ellipses server capability to core This will be used in core logic to determining whether a server is ellipses enabled or not. And also this will ease moving narrow related things to core. Differential Revision: https://phab.mercurial-scm.org/D4809 diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -32,10 +32,6 @@ from mercurial import ( wireprotoserver, ) -from . import ( - narrowwirepeer, -) - table = {} command = registrar.command(table) @@ -148,7 +144,7 @@ def pullbundle2extraprepare(orig, pullop kwargs['excludepats'] = exclude # calculate known nodes only in ellipses cases because in non-ellipses cases # we have all the nodes - if narrowwirepeer.ELLIPSESCAP in pullop.remote.capabilities(): + if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities(): kwargs['known'] = [node.hex(ctx.node()) for ctx in repo.set('::%ln', pullop.common) if ctx.node() != node.nullid] diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -13,7 +13,6 @@ from mercurial import ( from . import ( narrowdirstate, - narrowwirepeer, ) def wraprepo(repo): @@ -28,7 +27,7 @@ def wraprepo(repo): def peer(self): peer = super(narrowrepository, self).peer() peer._caps.add(wireprotoserver.NARROWCAP) - peer._caps.add(narrowwirepeer.ELLIPSESCAP) + peer._caps.add(wireprotoserver.ELLIPSESCAP) return peer repo.__class__ = narrowrepository diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -14,8 +14,6 @@ from mercurial import ( wireprotov1server, ) -ELLIPSESCAP = 'exp-ellipses-1' - def uisetup(): extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap) @@ -24,7 +22,7 @@ def addnarrowcap(orig, repo, proto): caps = orig(repo, proto) caps.append(wireprotoserver.NARROWCAP) if repo.ui.configbool('experimental', 'narrowservebrokenellipses'): - caps.append(ELLIPSESCAP) + caps.append(wireprotoserver.ELLIPSESCAP) return caps def reposetup(repo): diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -39,6 +39,7 @@ HGTYPE2 = 'application/mercurial-0.2' HGERRTYPE = 'application/hg-error' NARROWCAP = 'exp-narrow-1' +ELLIPSESCAP = 'exp-ellipses-1' SSHV1 = wireprototypes.SSHV1 SSHV2 = wireprototypes.SSHV2