diff hgext/narrow/narrowcommands.py @ 40074:f7011b44d205

wireprotoserver: move narrow capabilities to wireprototypes.py This is done because wireprotoserver import wireprotov1server, so you cannot import wireprotoserver in wireprotov1server to use the capabilities constants. Differential Revision: https://phab.mercurial-scm.org/D4890
author Pulkit Goyal <pulkit@yandex-team.ru>
date Fri, 05 Oct 2018 22:31:12 +0300
parents 8feae5b989bc
children 30a7d3b6b281
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py	Fri Oct 05 22:19:19 2018 +0300
+++ b/hgext/narrow/narrowcommands.py	Fri Oct 05 22:31:12 2018 +0300
@@ -30,7 +30,7 @@
     repoview,
     sparse,
     util,
-    wireprotoserver,
+    wireprototypes,
 )
 
 table = {}
@@ -134,7 +134,7 @@
     if repository.NARROW_REQUIREMENT not in repo.requirements:
         return orig(pullop, kwargs)
 
-    if wireprotoserver.NARROWCAP not in pullop.remote.capabilities():
+    if wireprototypes.NARROWCAP not in pullop.remote.capabilities():
         raise error.Abort(_("server does not support narrow clones"))
     orig(pullop, kwargs)
     kwargs['narrow'] = True
@@ -145,7 +145,7 @@
     kwargs['excludepats'] = exclude
     # calculate known nodes only in ellipses cases because in non-ellipses cases
     # we have all the nodes
-    if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities():
+    if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities():
         kwargs['known'] = [node.hex(ctx.node()) for ctx in
                            repo.set('::%ln', pullop.common)
                            if ctx.node() != node.nullid]
@@ -259,7 +259,7 @@
     # then send that information to server whether we want ellipses or not.
     # Theoretically a non-ellipses repo should be able to use narrow
     # functionality from an ellipses enabled server
-    ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities()
+    ellipsesremote = wireprototypes.ELLIPSESCAP in remote.capabilities()
 
     def pullbundle2extraprepare_widen(orig, pullop, kwargs):
         orig(pullop, kwargs)
@@ -427,7 +427,7 @@
         # check narrow support before doing anything if widening needs to be
         # performed. In future we should also abort if client is ellipses and
         # server does not support ellipses
-        if widening and wireprotoserver.NARROWCAP not in remote.capabilities():
+        if widening and wireprototypes.NARROWCAP not in remote.capabilities():
             raise error.Abort(_("server does not support narrow clones"))
 
         commoninc = discovery.findcommonincoming(repo, remote)