Mercurial > public > mercurial-scm > hg-stable
diff mercurial/exchange.py @ 32262:6068712cbf03
bundle2: move tagsfnodecache generation in a generic function
This will help us reusing the logic for `hg bundle`.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 05 May 2017 17:28:52 +0200 |
parents | 4462a981e8df |
children | 205bd3936179 |
line wrap: on
line diff
--- a/mercurial/exchange.py Fri May 05 17:09:47 2017 +0200 +++ b/mercurial/exchange.py Fri May 05 17:28:52 2017 +0200 @@ -28,7 +28,6 @@ scmutil, sslutil, streamclone, - tags, url as urlmod, util, ) @@ -1663,30 +1662,7 @@ return outgoing = _computeoutgoing(repo, heads, common) - - if not outgoing.missingheads: - return - - cache = tags.hgtagsfnodescache(repo.unfiltered()) - chunks = [] - - # .hgtags fnodes are only relevant for head changesets. While we could - # transfer values for all known nodes, there will likely be little to - # no benefit. - # - # We don't bother using a generator to produce output data because - # a) we only have 40 bytes per head and even esoteric numbers of heads - # consume little memory (1M heads is 40MB) b) we don't want to send the - # part if we don't have entries and knowing if we have entries requires - # cache lookups. - for node in outgoing.missingheads: - # Don't compute missing, as this may slow down serving. - fnode = cache.getfnode(node, computemissing=False) - if fnode is not None: - chunks.extend([node, fnode]) - - if chunks: - bundler.newpart('hgtagsfnodes', data=''.join(chunks)) + bundle2.addparttagsfnodescache(repo, bundler, outgoing) def _getbookmarks(repo, **kwargs): """Returns bookmark to node mapping.