Patchwork D6532: export: don't prefetch *all* files in manifest

login
register
mail settings
Submitter phabricator
Date June 14, 2019, 11:16 p.m.
Message ID <30086f7525410e9b222f5dd4c6794961@localhost.localdomain>
Download mbox | patch
Permalink /patch/40525/
State Not Applicable
Headers show

Comments

phabricator - June 14, 2019, 11:16 p.m.
Closed by commit rHG307f67d4aee3: export: don&#039;t prefetch *all* files in manifest (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6532?vs=15520&id=15522

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6532/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6532

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

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: