Mercurial > hg
changeset 39672:a1942015c10e
changegroup: add functionality to skip adding changelog data to changegroup
In narrow extension, when we have a non-ellipses narrow working copy and we
extend it, we pull all the changelog data again and the client tries to reapply
all that changelog data.
While downloading millions of changeset data is still not very expensive but
applying them on the client side is very expensive and takes ~10 minutes. These
10 minutes are added to every `hg tracked --addinclude <>` call and extending
a narrow copy becomes very slow.
This patch adds a new changelog argument to cgpacker.generate() fn. If the
changelog argument is set to False, we won't yield the changelog data. We still
have to iterate over the deltas returned by _generatechangelog() because that's
a generator and builds the data for clstate variable which is required for
calculating manifests and filelogs.
Differential Revision: https://phab.mercurial-scm.org/D4638
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Mon, 17 Sep 2018 21:41:34 +0300 |
parents | dee887072f27 |
children | f1844a10ee19 |
files | mercurial/changegroup.py |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changegroup.py Tue Sep 18 10:46:19 2018 -0700 +++ b/mercurial/changegroup.py Mon Sep 17 21:41:34 2018 +0300 @@ -827,8 +827,11 @@ else: self._verbosenote = lambda s: None - def generate(self, commonrevs, clnodes, fastpathlinkrev, source): - """Yield a sequence of changegroup byte chunks.""" + def generate(self, commonrevs, clnodes, fastpathlinkrev, source, + changelog=True): + """Yield a sequence of changegroup byte chunks. + If changelog is False, changelog data won't be added to changegroup + """ repo = self._repo cl = repo.changelog @@ -838,9 +841,11 @@ clstate, deltas = self._generatechangelog(cl, clnodes) for delta in deltas: - for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): - size += len(chunk) - yield chunk + if changelog: + for chunk in _revisiondeltatochunks(delta, + self._builddeltaheader): + size += len(chunk) + yield chunk close = closechunk() size += len(close)