comparison mercurial/exchange.py @ 38789:9b64b73d702b

exchange: move disabling of rev-branch-cache bundle part out of narrow I'm attempting to refactor changegroup code in order to better support alternate storage backends. The narrow extension is performing a lot of monkeypatching to this code and it is making it difficult to reason about how everything works. I'm reasonably certain I would be unable to abstract storage without requiring extensive rework of narrow. I believe it is less effort to move narrow code into core so it can be accounted for when changegroup code is refactored. So I'll be doing that. The first part of this is integrating the disabling of the cache:rev-branch-cache bundle2 part into core. This doesn't seem like it is related to changegroup, but narrow's modifications to changegroup are invasive and also require taking its code for bundle generation and exchange into core in order for the changegroup code to work. Differential Revision: https://phab.mercurial-scm.org/D4007
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 28 Jul 2018 10:41:23 -0700
parents 4d5fb4062f0b
children 3e7387337a3c
comparison
equal deleted inserted replaced
38788:a9ff2b0c11dd 38789:9b64b73d702b
41 stringutil, 41 stringutil,
42 ) 42 )
43 43
44 urlerr = util.urlerr 44 urlerr = util.urlerr
45 urlreq = util.urlreq 45 urlreq = util.urlreq
46
47 _NARROWACL_SECTION = 'narrowhgacl'
46 48
47 # Maps bundle version human names to changegroup versions. 49 # Maps bundle version human names to changegroup versions.
48 _bundlespeccgversions = {'v1': '01', 50 _bundlespeccgversions = {'v1': '01',
49 'v2': '02', 51 'v2': '02',
50 'packed1': 's1', 52 'packed1': 's1',
2067 5) closed heads nodes 2069 5) closed heads nodes
2068 """ 2070 """
2069 # Don't send unless: 2071 # Don't send unless:
2070 # - changeset are being exchanged, 2072 # - changeset are being exchanged,
2071 # - the client supports it. 2073 # - the client supports it.
2072 if not (kwargs.get(r'cg', True)) or 'rev-branch-cache' not in b2caps: 2074 # - narrow bundle isn't in play (not currently compatible).
2073 return 2075 if (not kwargs.get(r'cg', True)
2076 or 'rev-branch-cache' not in b2caps
2077 or kwargs.get(r'narrow', False)
2078 or repo.ui.has_section(_NARROWACL_SECTION)):
2079 return
2080
2074 outgoing = _computeoutgoing(repo, heads, common) 2081 outgoing = _computeoutgoing(repo, heads, common)
2075 bundle2.addpartrevbranchcache(repo, bundler, outgoing) 2082 bundle2.addpartrevbranchcache(repo, bundler, outgoing)
2076 2083
2077 def check_heads(repo, their_heads, context): 2084 def check_heads(repo, their_heads, context):
2078 """check if the heads of a repo have been modified 2085 """check if the heads of a repo have been modified