##// END OF EJS Templates
bundle2: move tagsfnodecache generation in a generic function...
marmoute -
r32217:6068712c default
parent child Browse files
Show More
@@ -1375,6 +1375,30 b' def _addpartsfromopts(ui, repo, bundler,'
1375 part.addparam('nbchanges', str(cg.extras['clcount']),
1375 part.addparam('nbchanges', str(cg.extras['clcount']),
1376 mandatory=False)
1376 mandatory=False)
1377
1377
1378 def addparttagsfnodescache(repo, bundler, outgoing):
1379 # we include the tags fnode cache for the bundle changeset
1380 # (as an optional parts)
1381 cache = tags.hgtagsfnodescache(repo.unfiltered())
1382 chunks = []
1383
1384 # .hgtags fnodes are only relevant for head changesets. While we could
1385 # transfer values for all known nodes, there will likely be little to
1386 # no benefit.
1387 #
1388 # We don't bother using a generator to produce output data because
1389 # a) we only have 40 bytes per head and even esoteric numbers of heads
1390 # consume little memory (1M heads is 40MB) b) we don't want to send the
1391 # part if we don't have entries and knowing if we have entries requires
1392 # cache lookups.
1393 for node in outgoing.missingheads:
1394 # Don't compute missing, as this may slow down serving.
1395 fnode = cache.getfnode(node, computemissing=False)
1396 if fnode is not None:
1397 chunks.extend([node, fnode])
1398
1399 if chunks:
1400 bundler.newpart('hgtagsfnodes', data=''.join(chunks))
1401
1378 def writebundle(ui, cg, filename, bundletype, vfs=None, compression=None,
1402 def writebundle(ui, cg, filename, bundletype, vfs=None, compression=None,
1379 compopts=None):
1403 compopts=None):
1380 """Write a bundle file and return its filename.
1404 """Write a bundle file and return its filename.
@@ -28,7 +28,6 b' from . import ('
28 scmutil,
28 scmutil,
29 sslutil,
29 sslutil,
30 streamclone,
30 streamclone,
31 tags,
32 url as urlmod,
31 url as urlmod,
33 util,
32 util,
34 )
33 )
@@ -1663,30 +1662,7 b' def _getbundletagsfnodes(bundler, repo, '
1663 return
1662 return
1664
1663
1665 outgoing = _computeoutgoing(repo, heads, common)
1664 outgoing = _computeoutgoing(repo, heads, common)
1666
1665 bundle2.addparttagsfnodescache(repo, bundler, outgoing)
1667 if not outgoing.missingheads:
1668 return
1669
1670 cache = tags.hgtagsfnodescache(repo.unfiltered())
1671 chunks = []
1672
1673 # .hgtags fnodes are only relevant for head changesets. While we could
1674 # transfer values for all known nodes, there will likely be little to
1675 # no benefit.
1676 #
1677 # We don't bother using a generator to produce output data because
1678 # a) we only have 40 bytes per head and even esoteric numbers of heads
1679 # consume little memory (1M heads is 40MB) b) we don't want to send the
1680 # part if we don't have entries and knowing if we have entries requires
1681 # cache lookups.
1682 for node in outgoing.missingheads:
1683 # Don't compute missing, as this may slow down serving.
1684 fnode = cache.getfnode(node, computemissing=False)
1685 if fnode is not None:
1686 chunks.extend([node, fnode])
1687
1688 if chunks:
1689 bundler.newpart('hgtagsfnodes', data=''.join(chunks))
1690
1666
1691 def _getbookmarks(repo, **kwargs):
1667 def _getbookmarks(repo, **kwargs):
1692 """Returns bookmark to node mapping.
1668 """Returns bookmark to node mapping.
General Comments 0
You need to be logged in to leave comments. Login now