treemanifest: don't fallback to flat manifests on a treeonly server

Summary:
This flow shouldn't ever be hit, but it was exposed by the bug fixed in
the previous patch. Let's go ahead and make this code path not fall back to flat
manifests if the server is treeonly.

Reviewed By: quark-zju, singhsrb

Differential Revision: D10156426

fbshipit-source-id: c766bca318712b61fd1b851990849f3d93362c2e
This commit is contained in:
Durham Goode 2018-10-03 08:46:17 -07:00 committed by Facebook Github Bot
parent b3e328c903
commit 43c0f47cf5

View File

@ -88,7 +88,7 @@ class shallowcg1packer(changegroup.cg1packer):
if not util.safehasattr(repo.manifestlog, "_revlog"): if not util.safehasattr(repo.manifestlog, "_revlog"):
return False return False
if repo.ui.configbool("treemanifest", "treeonly"): if treeonly(repo):
return False return False
revlog = repo.manifestlog._revlog revlog = repo.manifestlog._revlog
@ -175,7 +175,7 @@ class shallowcg1packer(changegroup.cg1packer):
p1node = mfctx.parents[0] p1node = mfctx.parents[0]
p1ctx = mflog[p1node] p1ctx = mflog[p1node]
except LookupError: except LookupError:
if not repo.svfs.treemanifestserver: if not repo.svfs.treemanifestserver or treeonly(repo):
raise raise
# If we can't find the flat version, look for trees # If we can't find the flat version, look for trees
tmfl = mflog.treemanifestlog tmfl = mflog.treemanifestlog
@ -555,7 +555,6 @@ def cansendtrees(repo, nodes, source=None, bundlecaps=None, b2caps=None):
if bundlecaps is None: if bundlecaps is None:
bundlecaps = set() bundlecaps = set()
sendtrees = repo.ui.configbool("treemanifest", "sendtrees") sendtrees = repo.ui.configbool("treemanifest", "sendtrees")
treeonly = repo.ui.configbool("treemanifest", "treeonly")
def clienthascap(cap): def clienthascap(cap):
return cap in bundlecaps or "True" in b2caps.get(cap, []) return cap in bundlecaps or "True" in b2caps.get(cap, [])
@ -587,7 +586,7 @@ def cansendtrees(repo, nodes, source=None, bundlecaps=None, b2caps=None):
# they're doing a push, but that should almost never happen. # they're doing a push, but that should almost never happen.
result = LocalTrees result = LocalTrees
prefetch = LocalTrees prefetch = LocalTrees
if not treeonly: if not treeonly(repo):
# If we're sending trees and flats, then we need to prefetch # If we're sending trees and flats, then we need to prefetch
# everything, since when it inspects the flat manifests it will # everything, since when it inspects the flat manifests it will
# attempt to access the tree equivalent. # attempt to access the tree equivalent.
@ -608,3 +607,7 @@ def cansendtrees(repo, nodes, source=None, bundlecaps=None, b2caps=None):
pass pass
return result return result
def treeonly(repo):
return repo.ui.configbool("treemanifest", "treeonly")