mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
shallowbundle: handle changegroup3
Upstream has changed local bundles to use the highest available changegroup version, which means we're using changegroup3 for strips now. So we need to handle that in shallowbundle.
This commit is contained in:
parent
0d2cd6bff2
commit
8bb86ab225
@ -262,10 +262,13 @@ def onetimeclientsetup(ui):
|
||||
# Mercurial >= 3.3
|
||||
packermap01 = packermap['01']
|
||||
packermap02 = packermap['02']
|
||||
packermap03 = packermap['03']
|
||||
packermap['01'] = (shallowbundle.shallowcg1packer,
|
||||
packermap01[1])
|
||||
packermap['02'] = (shallowbundle.shallowcg2packer,
|
||||
packermap02[1])
|
||||
packermap['03'] = (shallowbundle.shallowcg3packer,
|
||||
packermap03[1])
|
||||
if util.safehasattr(changegroup, '_addchangegroupfiles'):
|
||||
fn = '_addchangegroupfiles' # hg >= 3.6
|
||||
else:
|
||||
|
@ -224,6 +224,30 @@ if util.safehasattr(changegroup, 'cg2packer'):
|
||||
return shallowgroup(shallowcg2packer, self, nodelist, rlog, lookup,
|
||||
units=units)
|
||||
|
||||
if util.safehasattr(changegroup, 'cg3packer'):
|
||||
@shallowutil.interposeclass(changegroup, 'cg3packer')
|
||||
class shallowcg3packer(changegroup.cg3packer):
|
||||
def generatemanifests(self, commonrevs, clrevorder, fastpathlinkrev,
|
||||
mfs, fnodes, source):
|
||||
chunks = super(shallowcg3packer, self).generatemanifests(
|
||||
commonrevs,
|
||||
clrevorder,
|
||||
fastpathlinkrev,
|
||||
mfs,
|
||||
fnodes,
|
||||
source,
|
||||
)
|
||||
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:
|
||||
yield self._manifestsdone()
|
||||
|
||||
# Unused except in older versions of Mercurial
|
||||
def getchangegroup(orig, repo, source, outgoing, bundlecaps=None, version='01'):
|
||||
def origmakechangegroup(repo, outgoing, version, source):
|
||||
|
@ -269,7 +269,7 @@ Test peer-to-peer push/pull of tree only commits
|
||||
|
||||
# Test pulling from a treeonly peer
|
||||
$ hg pull -r tip ssh://user@dummy/client --debug 2>&1 | egrep "(payload|treegroup)"
|
||||
bundle2-input-part: total payload size 823
|
||||
bundle2-input-part: total payload size 827
|
||||
bundle2-input-part: total payload size 171
|
||||
bundle2-input-part: "b2x:treegroup2" (params: 3 mandatory) supported
|
||||
bundle2-input-part: total payload size 663
|
||||
@ -363,7 +363,7 @@ Test pushing to a hybrid server w/ pushrebase w/o hooks
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 0 changes to 0 files (+1 heads)
|
||||
added 1 changesets with 1 changes to 1 files (+1 heads)
|
||||
|
||||
$ cd ../master
|
||||
- Verify the received tree was written down as a flat
|
||||
|
@ -670,9 +670,12 @@ def _unpackmanifestscg3(orig, self, repo, *args, **kwargs):
|
||||
|
||||
if repo.ui.configbool('treemanifest', 'treeonly'):
|
||||
self.manifestheader()
|
||||
chain = None
|
||||
for chunkdata in iter(lambda: self.deltachunk(chain), {}):
|
||||
chain = chunkdata['node']
|
||||
for delta in self.deltaiter():
|
||||
pass
|
||||
# Handle sub-tree manifests
|
||||
for chunkdata in iter(self.filelogheader, {}):
|
||||
for delta in self.deltaiter():
|
||||
pass
|
||||
return
|
||||
return orig(self, repo, *args, **kwargs)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user