##// END OF EJS Templates
wireprotoserver: move narrow capabilities to wireprototypes.py...
Pulkit Goyal -
r40110:f7011b44 default
parent child Browse files
Show More
@@ -30,7 +30,7 b' from mercurial import ('
30 repoview,
30 repoview,
31 sparse,
31 sparse,
32 util,
32 util,
33 wireprotoserver,
33 wireprototypes,
34 )
34 )
35
35
36 table = {}
36 table = {}
@@ -134,7 +134,7 b' def pullbundle2extraprepare(orig, pullop'
134 if repository.NARROW_REQUIREMENT not in repo.requirements:
134 if repository.NARROW_REQUIREMENT not in repo.requirements:
135 return orig(pullop, kwargs)
135 return orig(pullop, kwargs)
136
136
137 if wireprotoserver.NARROWCAP not in pullop.remote.capabilities():
137 if wireprototypes.NARROWCAP not in pullop.remote.capabilities():
138 raise error.Abort(_("server does not support narrow clones"))
138 raise error.Abort(_("server does not support narrow clones"))
139 orig(pullop, kwargs)
139 orig(pullop, kwargs)
140 kwargs['narrow'] = True
140 kwargs['narrow'] = True
@@ -145,7 +145,7 b' def pullbundle2extraprepare(orig, pullop'
145 kwargs['excludepats'] = exclude
145 kwargs['excludepats'] = exclude
146 # calculate known nodes only in ellipses cases because in non-ellipses cases
146 # calculate known nodes only in ellipses cases because in non-ellipses cases
147 # we have all the nodes
147 # we have all the nodes
148 if wireprotoserver.ELLIPSESCAP in pullop.remote.capabilities():
148 if wireprototypes.ELLIPSESCAP in pullop.remote.capabilities():
149 kwargs['known'] = [node.hex(ctx.node()) for ctx in
149 kwargs['known'] = [node.hex(ctx.node()) for ctx in
150 repo.set('::%ln', pullop.common)
150 repo.set('::%ln', pullop.common)
151 if ctx.node() != node.nullid]
151 if ctx.node() != node.nullid]
@@ -259,7 +259,7 b' def _widen(ui, repo, remote, commoninc, '
259 # then send that information to server whether we want ellipses or not.
259 # then send that information to server whether we want ellipses or not.
260 # Theoretically a non-ellipses repo should be able to use narrow
260 # Theoretically a non-ellipses repo should be able to use narrow
261 # functionality from an ellipses enabled server
261 # functionality from an ellipses enabled server
262 ellipsesremote = wireprotoserver.ELLIPSESCAP in remote.capabilities()
262 ellipsesremote = wireprototypes.ELLIPSESCAP in remote.capabilities()
263
263
264 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
264 def pullbundle2extraprepare_widen(orig, pullop, kwargs):
265 orig(pullop, kwargs)
265 orig(pullop, kwargs)
@@ -427,7 +427,7 b' def trackedcmd(ui, repo, remotepath=None'
427 # check narrow support before doing anything if widening needs to be
427 # check narrow support before doing anything if widening needs to be
428 # performed. In future we should also abort if client is ellipses and
428 # performed. In future we should also abort if client is ellipses and
429 # server does not support ellipses
429 # server does not support ellipses
430 if widening and wireprotoserver.NARROWCAP not in remote.capabilities():
430 if widening and wireprototypes.NARROWCAP not in remote.capabilities():
431 raise error.Abort(_("server does not support narrow clones"))
431 raise error.Abort(_("server does not support narrow clones"))
432
432
433 commoninc = discovery.findcommonincoming(repo, remote)
433 commoninc = discovery.findcommonincoming(repo, remote)
@@ -8,7 +8,7 b''
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 from mercurial import (
10 from mercurial import (
11 wireprotoserver,
11 wireprototypes,
12 )
12 )
13
13
14 from . import (
14 from . import (
@@ -26,8 +26,8 b' def wraprepo(repo):'
26
26
27 def peer(self):
27 def peer(self):
28 peer = super(narrowrepository, self).peer()
28 peer = super(narrowrepository, self).peer()
29 peer._caps.add(wireprotoserver.NARROWCAP)
29 peer._caps.add(wireprototypes.NARROWCAP)
30 peer._caps.add(wireprotoserver.ELLIPSESCAP)
30 peer._caps.add(wireprototypes.ELLIPSESCAP)
31 return peer
31 return peer
32
32
33 repo.__class__ = narrowrepository
33 repo.__class__ = narrowrepository
@@ -15,7 +15,6 b' from mercurial import ('
15 match as matchmod,
15 match as matchmod,
16 narrowspec,
16 narrowspec,
17 pycompat,
17 pycompat,
18 wireprotoserver,
19 wireprototypes,
18 wireprototypes,
20 wireprotov1peer,
19 wireprotov1peer,
21 wireprotov1server,
20 wireprotov1server,
@@ -28,9 +27,9 b' def uisetup():'
28 def addnarrowcap(orig, repo, proto):
27 def addnarrowcap(orig, repo, proto):
29 """add the narrow capability to the server"""
28 """add the narrow capability to the server"""
30 caps = orig(repo, proto)
29 caps = orig(repo, proto)
31 caps.append(wireprotoserver.NARROWCAP)
30 caps.append(wireprototypes.NARROWCAP)
32 if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
31 if repo.ui.configbool('experimental', 'narrowservebrokenellipses'):
33 caps.append(wireprotoserver.ELLIPSESCAP)
32 caps.append(wireprototypes.ELLIPSESCAP)
34 return caps
33 return caps
35
34
36 def reposetup(repo):
35 def reposetup(repo):
@@ -38,9 +38,6 b" HGTYPE = 'application/mercurial-0.1'"
38 HGTYPE2 = 'application/mercurial-0.2'
38 HGTYPE2 = 'application/mercurial-0.2'
39 HGERRTYPE = 'application/hg-error'
39 HGERRTYPE = 'application/hg-error'
40
40
41 NARROWCAP = 'exp-narrow-1'
42 ELLIPSESCAP = 'exp-ellipses-1'
43
44 SSHV1 = wireprototypes.SSHV1
41 SSHV1 = wireprototypes.SSHV1
45 SSHV2 = wireprototypes.SSHV2
42 SSHV2 = wireprototypes.SSHV2
46
43
@@ -28,6 +28,9 b" SSHV1 = 'ssh-v1'"
28 SSHV2 = 'exp-ssh-v2-0002'
28 SSHV2 = 'exp-ssh-v2-0002'
29 HTTP_WIREPROTO_V2 = 'exp-http-v2-0002'
29 HTTP_WIREPROTO_V2 = 'exp-http-v2-0002'
30
30
31 NARROWCAP = 'exp-narrow-1'
32 ELLIPSESCAP = 'exp-ellipses-1'
33
31 # All available wire protocol transports.
34 # All available wire protocol transports.
32 TRANSPORTS = {
35 TRANSPORTS = {
33 SSHV1: {
36 SSHV1: {
General Comments 0
You need to be logged in to leave comments. Login now