mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
hg: fix sending trees from the server to non-tree clients
Summary: Previously we were trying to send trees to all clients during an infinitepull, even ones that didn't support treemanifest. This caused infinitepulls that required rebundling to fail for non-tree clients. The fix is to just not send them unless the client is advertising the capability. Reviewed By: phillco Differential Revision: D7432374 fbshipit-source-id: 1fae14a158ef56fe39439a718b1b98928f4e07b0
This commit is contained in:
parent
78965e53ca
commit
f5b8d91797
@ -529,9 +529,21 @@ def _rebundle(bundlerepo, bundleroots, unknownhead, cgversion, bundlecaps):
|
||||
except KeyError:
|
||||
pass
|
||||
else:
|
||||
# This parsing should be refactored to be shared with
|
||||
# exchange.getbundlechunks. But I'll do that in a separate diff.
|
||||
if bundlecaps is None:
|
||||
bundlecaps = set()
|
||||
b2caps = {}
|
||||
for bcaps in bundlecaps:
|
||||
if bcaps.startswith('bundle2='):
|
||||
blob = util.urlreq.unquote(bcaps[len('bundle2='):])
|
||||
b2caps.update(bundle2.decodecaps(blob))
|
||||
|
||||
missing = outgoing.missing
|
||||
if remotefilelog.shallowbundle.cansendtrees(bundlerepo, missing,
|
||||
source='infinitepushpull'):
|
||||
source='infinitepushpull',
|
||||
bundlecaps=bundlecaps,
|
||||
b2caps=b2caps):
|
||||
treepart = treemod.createtreepackpart(bundlerepo, outgoing,
|
||||
treemod.TREEGROUP_PARTTYPE2)
|
||||
parts.append(treepart)
|
||||
|
@ -509,7 +509,8 @@ def cansendtrees(repo, nodes, source=None, bundlecaps=None, b2caps=None):
|
||||
prefetch = AllTrees
|
||||
|
||||
if repo.svfs.treemanifestserver:
|
||||
if source == 'infinitepushpull':
|
||||
if (source == 'infinitepushpull' and
|
||||
'True' in b2caps.get('treemanifest', [])):
|
||||
result = AllTrees
|
||||
else:
|
||||
result = NoTrees
|
||||
|
@ -272,6 +272,18 @@ Pull a normal scratch branch into a treeonly client
|
||||
|
||||
$ cd ..
|
||||
|
||||
Pull a normal scratch branch into a normal client with rebundling where the
|
||||
server has treemanifest enabled.
|
||||
$ cd normal-client
|
||||
$ hg pull -r 42ec76eb772a --config extensions.treemanifest=! --config fastmanifest.usetree=False
|
||||
pulling from ssh://user@dummy/master
|
||||
no changes found
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 0 changesets with 1 changes to 1 files
|
||||
$ cd ..
|
||||
|
||||
Verify its not on the server
|
||||
$ cd master
|
||||
$ hg log -G
|
||||
|
Loading…
Reference in New Issue
Block a user