comparison mercurial/exchange.py @ 43131:c17a63eb5d4c

sidedata: apply basic but tight security around exchange We don't currently have code to deal with exchange between repository using sidedata and repository not using sidedata. Until we implement such code (eg: dropping side data when pushing to a non-sidedata repo) we prevent the two kind of repo to speak to each other. This is somewhere similar to what 'treemanifest' does. Note that sidedata exchange is broken unless one use changegroup v3 anyway. See next changeset for details. Differential Revision: https://phab.mercurial-scm.org/D6939
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 06 Oct 2019 23:36:51 -0400
parents 8ff1ecfadcd1
children 01e8eefd9434
comparison
equal deleted inserted replaced
43130:c88075eb28e3 43131:c17a63eb5d4c
1047 cgpart = bundler.newpart(b'changegroup', data=cgstream) 1047 cgpart = bundler.newpart(b'changegroup', data=cgstream)
1048 if cgversions: 1048 if cgversions:
1049 cgpart.addparam(b'version', version) 1049 cgpart.addparam(b'version', version)
1050 if b'treemanifest' in pushop.repo.requirements: 1050 if b'treemanifest' in pushop.repo.requirements:
1051 cgpart.addparam(b'treemanifest', b'1') 1051 cgpart.addparam(b'treemanifest', b'1')
1052 if b'exp-sidedata-flag' in pushop.repo.requirements:
1053 cgpart.addparam(b'exp-sidedata', b'1')
1052 1054
1053 def handlereply(op): 1055 def handlereply(op):
1054 """extract addchangegroup returns from server reply""" 1056 """extract addchangegroup returns from server reply"""
1055 cgreplies = op.records.getreplies(cgpart.id) 1057 cgreplies = op.records.getreplies(cgpart.id)
1056 assert len(cgreplies[b'changegroup']) == 1 1058 assert len(cgreplies[b'changegroup']) == 1
2509 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False) 2511 part.addparam(b'nbchanges', b'%d' % len(outgoing.missing), mandatory=False)
2510 2512
2511 if b'treemanifest' in repo.requirements: 2513 if b'treemanifest' in repo.requirements:
2512 part.addparam(b'treemanifest', b'1') 2514 part.addparam(b'treemanifest', b'1')
2513 2515
2516 if b'exp-sidedata-flag' in repo.requirements:
2517 part.addparam(b'exp-sidedata', b'1')
2518
2514 if ( 2519 if (
2515 kwargs.get(r'narrow', False) 2520 kwargs.get(r'narrow', False)
2516 and kwargs.get(r'narrow_acl', False) 2521 and kwargs.get(r'narrow_acl', False)
2517 and (include or exclude) 2522 and (include or exclude)
2518 ): 2523 ):