D6532: export: don't prefetch *all* files in manifest
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Jun 14 21:27:40 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
`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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D6532
AFFECTED FILES
mercurial/cmdutil.py
CHANGE DETAILS
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, '<unnamed>', 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', '<unnamed>')
with formatter.formatter(repo.ui, fp, 'export', {}) as fm:
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list