mirror of
https://github.com/facebook/sapling.git
synced 2025-01-04 03:06:30 +03:00
treemanifest: refactor pack part creation to its own function
Summary: A future patch will use this same logic to create pack parts, so let's make it reusable. Test Plan: Ran the tests Reviewers: #mercurial, mitrandir Reviewed By: mitrandir Subscribers: medson, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D5326175 Signature: t1:5326175:1498751898:bf71081ab6309aa48c5ccadfd7e46d7d67588367
This commit is contained in:
parent
0a0ba996ea
commit
0ce2a60ef6
@ -780,25 +780,33 @@ def _registerbundle2parts():
|
|||||||
return
|
return
|
||||||
pushop.stepsdone.add('treepack')
|
pushop.stepsdone.add('treepack')
|
||||||
|
|
||||||
rootdir = ''
|
part = createtreepackpart(pushop.repo, pushop.outgoing,
|
||||||
mfnodes = []
|
TREEGROUP_PARTTYPE2)
|
||||||
basemfnodes = []
|
bundler.addpart(part)
|
||||||
directories = []
|
|
||||||
|
|
||||||
outgoing = pushop.outgoing
|
def createtreepackpart(repo, outgoing, partname):
|
||||||
for node in outgoing.missing:
|
rootdir = ''
|
||||||
mfnode = pushop.repo[node].manifestnode()
|
mfnodes = []
|
||||||
mfnodes.append(mfnode)
|
basemfnodes = []
|
||||||
basectxs = pushop.repo.set('parents(roots(%ln))', outgoing.missing)
|
directories = []
|
||||||
for basectx in basectxs:
|
|
||||||
basemfnodes.append(basectx.manifestnode())
|
|
||||||
|
|
||||||
packstream = generatepackstream(pushop.repo, rootdir, mfnodes,
|
for node in outgoing.missing:
|
||||||
basemfnodes, directories)
|
mfnode = repo[node].manifestnode()
|
||||||
part = bundler.newpart(TREEGROUP_PARTTYPE2, data=packstream)
|
mfnodes.append(mfnode)
|
||||||
part.addparam('version', '1')
|
basectxs = repo.set('parents(roots(%ln))', outgoing.missing)
|
||||||
part.addparam('cache', 'False')
|
for basectx in basectxs:
|
||||||
part.addparam('category', PACK_CATEGORY)
|
basemfnodes.append(basectx.manifestnode())
|
||||||
|
|
||||||
|
packstream = generatepackstream(repo, rootdir, mfnodes,
|
||||||
|
basemfnodes, directories)
|
||||||
|
part = bundle2.bundlepart(
|
||||||
|
partname,
|
||||||
|
data = packstream)
|
||||||
|
part.addparam('version', '1')
|
||||||
|
part.addparam('cache', 'False')
|
||||||
|
part.addparam('category', PACK_CATEGORY)
|
||||||
|
|
||||||
|
return part
|
||||||
|
|
||||||
def pull(orig, ui, repo, *pats, **opts):
|
def pull(orig, ui, repo, *pats, **opts):
|
||||||
result = orig(ui, repo, *pats, **opts)
|
result = orig(ui, repo, *pats, **opts)
|
||||||
|
Loading…
Reference in New Issue
Block a user