mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
treemanifest: remove sendflat config
Previously the sendflat config decided if we should send flat manifests or not. To reduce the number of config permutations we have to handle, let's change the code to always send the flat manifests, if it exists. Differential Revision: https://phab.mercurial-scm.org/D1266
This commit is contained in:
parent
df82fc6557
commit
2f95e6e9ca
@ -44,6 +44,17 @@ def shallowgroup(cls, self, nodelist, rlog, lookup, units=None, reorder=None):
|
||||
|
||||
yield self.close()
|
||||
|
||||
def _cansendflat(repo, mfnodes):
|
||||
if not util.safehasattr(repo.manifestlog, '_revlog'):
|
||||
return False
|
||||
|
||||
revlog = repo.manifestlog._revlog
|
||||
for mfnode in mfnodes:
|
||||
if mfnode not in revlog.nodemap:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
@shallowutil.interposeclass(changegroup, 'cg1packer')
|
||||
class shallowcg1packer(changegroup.cg1packer):
|
||||
def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
|
||||
@ -73,9 +84,7 @@ class shallowcg1packer(changegroup.cg1packer):
|
||||
core generatemanifests method, whose length depends on the
|
||||
version of core Hg.
|
||||
"""
|
||||
sendflat = self._repo.ui.configbool('treemanifest', 'sendflat',
|
||||
True)
|
||||
if sendflat:
|
||||
if _cansendflat(self._repo, mfs.keys()):
|
||||
# In this code path, generating the manifests populates fnodes for
|
||||
# us.
|
||||
chunks = super(shallowcg1packer, self).generatemanifests(
|
||||
@ -241,12 +250,10 @@ if util.safehasattr(changegroup, 'cg3packer'):
|
||||
for chunk in chunks:
|
||||
yield chunk
|
||||
|
||||
sendflat = self._repo.ui.configbool('treemanifest', 'sendflat',
|
||||
True)
|
||||
# If we're not sending flat manifests, then the subclass
|
||||
# generatemanifests call did not add the appropriate closing chunk
|
||||
# for a changegroup3.
|
||||
if not sendflat:
|
||||
if not _cansendflat(self._repo, mfs.keys()):
|
||||
yield self._manifestsdone()
|
||||
|
||||
# Unused except in older versions of Mercurial
|
||||
|
@ -120,10 +120,7 @@ Test pushing flat and tree
|
||||
[255]
|
||||
|
||||
Test pushing only trees with commit hooks
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [treemanifest]
|
||||
> sendflat=False
|
||||
> EOF
|
||||
TODO: change this to create a treeonly commit and try to push it
|
||||
$ hg push --to mybook
|
||||
pushing to ssh://user@dummy/master
|
||||
searching for changes
|
||||
|
@ -94,7 +94,6 @@ Transition to tree-only client
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [treemanifest]
|
||||
> treeonly=True
|
||||
> sendflat=False
|
||||
> EOF
|
||||
|
||||
Make a local tree-only draft commit
|
||||
|
@ -56,12 +56,6 @@ default values are 0 and len(changelog) - 1, respectively.
|
||||
repackstartrev = 0
|
||||
repackendrev = 1000
|
||||
|
||||
Setting `treemanifest.sendflat` to False will stop flat manifests from being
|
||||
sent as part of changegroups during push. It defaults to True.
|
||||
|
||||
[treemanifest]
|
||||
sendflat = True
|
||||
|
||||
Setting `treemanifest.treeonly` to True will force all manifest reads to use the
|
||||
tree format. This is useful in the final stages of a migration to treemanifest
|
||||
to prevent accesses of flat manifests.
|
||||
@ -1050,7 +1044,7 @@ def _registerbundle2parts():
|
||||
|
||||
# Treemanifest servers don't accept tree directly. They must go through
|
||||
# pushrebase, which uses it's own part type and handler.
|
||||
if op.repo.svfs.treemanifestserver:
|
||||
if repo.svfs.treemanifestserver:
|
||||
return
|
||||
|
||||
if part.params.get('cache', 'False') == 'True':
|
||||
|
Loading…
Reference in New Issue
Block a user