# HG changeset patch # User Martin von Zweigbergk # Date 1560532907 25200 # Node ID 307f67d4aee37fc8d7246ef8ef84b6c429f3ae1b # Parent d768ca4272498d5c39dbd423bced66f0292ea936 export: don't prefetch *all* files in manifest `hg export` only shows changed files, not all files, but we still prefetched all files in cmdutil.export(). The same is true for the other commands calling cmdutil.exportfile(). That meant that `hg export` with remotefilelog (or lfs, I assume) could take much longer than expected because it would download all the files in the repo. Differential Revision: https://phab.mercurial-scm.org/D6532 diff -r d768ca427249 -r 307f67d4aee3 mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Jun 14 13:50:06 2019 -0700 +++ b/mercurial/cmdutil.py Fri Jun 14 10:21:47 2019 -0700 @@ -1668,6 +1668,14 @@ _exportsingle(repo, ctx, fm, match, switch_parent, seqno, diffopts) +def _prefetchchangedfiles(repo, revs, match): + allfiles = set() + for rev in revs: + for file in repo[rev].files(): + if not match or match(file): + allfiles.add(file) + scmutil.prefetchfiles(repo, revs, scmutil.matchfiles(repo, allfiles)) + def export(repo, revs, basefm, fntemplate='hg-%h.patch', switch_parent=False, opts=None, match=None): '''export changesets as hg patches @@ -1692,7 +1700,7 @@ the given template. Otherwise: All revs will be written to basefm. ''' - scmutil.prefetchfiles(repo, revs, match) + _prefetchchangedfiles(repo, revs, match) if not fntemplate: _exportfile(repo, revs, basefm, '', switch_parent, opts, match) @@ -1702,7 +1710,7 @@ def exportfile(repo, revs, fp, switch_parent=False, opts=None, match=None): """Export changesets to the given file stream""" - scmutil.prefetchfiles(repo, revs, match) + _prefetchchangedfiles(repo, revs, match) dest = getattr(fp, 'name', '') with formatter.formatter(repo.ui, fp, 'export', {}) as fm: