Patchwork D5268: shelve: use matcher to restrict prefetch to just the modified files

login
register
mail settings
Submitter phabricator
Date Nov. 14, 2018, 1:02 p.m.
Message ID <29caef8ba44c6943f9a2e3a35ec4c0d3@localhost.localdomain>
Download mbox | patch
Permalink /patch/36572/
State Not Applicable
Headers show

Comments

phabricator - Nov. 14, 2018, 1:02 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG29e4a77b5305: shelve: use matcher to restrict prefetch to just the modified files (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5268?vs=12530&id=12535

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

AFFECTED FILES
  hgext/shelve.py

CHANGE DETAILS




To: spectral, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -430,8 +430,12 @@ 
     shelvedfile(repo, name, 'shelve').writeinfo(info)
     bases = list(mutableancestors(repo[node]))
     shelvedfile(repo, name, 'hg').writebundle(bases, node)
+    # Create a matcher so that prefetch doesn't attempt to fetch the entire
+    # repository pointlessly.
+    match = scmutil.matchfiles(repo, repo[node].files())
     with shelvedfile(repo, name, patchextension).opener('wb') as fp:
-        cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True))
+        cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True),
+                           match=match)
 
 def _includeunknownfiles(repo, pats, opts, extra):
     s = repo.status(match=scmutil.match(repo[None], pats, opts),