diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -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: