# HG changeset patch # User Pulkit Goyal # Date 1538769144 -10800 # Node ID ad8d8dc9be3f4a37454af388df5fbac92ecb1cd7 # Parent f7011b44d205a89b7c93205af66c9aa553d06cd0 narrow: move adding of narrow server capabilities to core 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. Differential Revision: https://phab.mercurial-scm.org/D4891 diff -r f7011b44d205 -r ad8d8dc9be3f hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py Fri Oct 05 22:31:12 2018 +0300 +++ b/hgext/narrow/narrowwirepeer.py Fri Oct 05 22:52:24 2018 +0300 @@ -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): diff -r f7011b44d205 -r ad8d8dc9be3f mercurial/wireprotov1server.py --- a/mercurial/wireprotov1server.py Fri Oct 05 22:31:12 2018 +0300 +++ b/mercurial/wireprotov1server.py Fri Oct 05 22:52:24 2018 +0300 @@ -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