Mercurial > hg
comparison mercurial/changegroup.py @ 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 | 9b07ee0a1054 |
children | c71f80bfb414 |
comparison
equal
deleted
inserted
replaced
39671:dee887072f27 | 39672:a1942015c10e |
---|---|
825 if self._repo.ui.verbose and not self._repo.ui.debugflag: | 825 if self._repo.ui.verbose and not self._repo.ui.debugflag: |
826 self._verbosenote = self._repo.ui.note | 826 self._verbosenote = self._repo.ui.note |
827 else: | 827 else: |
828 self._verbosenote = lambda s: None | 828 self._verbosenote = lambda s: None |
829 | 829 |
830 def generate(self, commonrevs, clnodes, fastpathlinkrev, source): | 830 def generate(self, commonrevs, clnodes, fastpathlinkrev, source, |
831 """Yield a sequence of changegroup byte chunks.""" | 831 changelog=True): |
832 """Yield a sequence of changegroup byte chunks. | |
833 If changelog is False, changelog data won't be added to changegroup | |
834 """ | |
832 | 835 |
833 repo = self._repo | 836 repo = self._repo |
834 cl = repo.changelog | 837 cl = repo.changelog |
835 | 838 |
836 self._verbosenote(_('uncompressed size of bundle content:\n')) | 839 self._verbosenote(_('uncompressed size of bundle content:\n')) |
837 size = 0 | 840 size = 0 |
838 | 841 |
839 clstate, deltas = self._generatechangelog(cl, clnodes) | 842 clstate, deltas = self._generatechangelog(cl, clnodes) |
840 for delta in deltas: | 843 for delta in deltas: |
841 for chunk in _revisiondeltatochunks(delta, self._builddeltaheader): | 844 if changelog: |
842 size += len(chunk) | 845 for chunk in _revisiondeltatochunks(delta, |
843 yield chunk | 846 self._builddeltaheader): |
847 size += len(chunk) | |
848 yield chunk | |
844 | 849 |
845 close = closechunk() | 850 close = closechunk() |
846 size += len(close) | 851 size += len(close) |
847 yield closechunk() | 852 yield closechunk() |
848 | 853 |