pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We use the experimental.narrow config option introduced in one of the previous
  patch and move the functionality of adding narrow server capabilities to core.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4891

AFFECTED FILES
  hgext/narrow/narrowwirepeer.py
  mercurial/wireprotov1server.py

CHANGE DETAILS

diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -286,6 +286,11 @@
         caps.append('bundle2=' + urlreq.quote(capsblob))
     caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority))
 
+    if repo.ui.configbool('experimental', 'narrow'):
+        caps.append(wireprototypes.NARROWCAP)
+        if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
+            caps.append(wireprototypes.ELLIPSESCAP)
+
     return proto.addcapabilities(repo, caps)
 
 # If you are writing an extension and consider wrapping this function. Wrap
diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py
--- a/hgext/narrow/narrowwirepeer.py
+++ b/hgext/narrow/narrowwirepeer.py
@@ -21,17 +21,8 @@
 )
 
 def uisetup():
-    extensions.wrapfunction(wireprotov1server, '_capabilities', addnarrowcap)
     wireprotov1peer.wirepeer.narrow_widen = peernarrowwiden
 
-def addnarrowcap(orig, repo, proto):
-    """add the narrow capability to the server"""
-    caps = orig(repo, proto)
-    caps.append(wireprototypes.NARROWCAP)
-    if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
-        caps.append(wireprototypes.ELLIPSESCAP)
-    return caps
-
 def reposetup(repo):
     def wirereposetup(ui, peer):
         def wrapped(orig, cmd, *args, **kwargs):



To: pulkit, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to