Patchwork D5280: changegroup: avoid instantiating storage if we are not using it

login
register
mail settings
Submitter phabricator
Date Nov. 17, 2018, 6:12 a.m.
Message ID <a1b176ebe31ce9471c0abbfe5f677216@localhost.localdomain>
Download mbox | patch
Permalink /patch/36632/
State Not Applicable
Headers show

Comments

phabricator - Nov. 17, 2018, 6:12 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdba590f27c7a: changegroup: avoid instantiating storage if we are not using it (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5280?vs=12552&id=12558

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

AFFECTED FILES
  mercurial/changegroup.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -1043,18 +1043,25 @@ 
 
         while tmfnodes:
             tree, nodes = tmfnodes.popitem()
+
+            should_visit = self._matcher.visitdir(tree[:-1] or '.')
+            if tree and not should_visit:
+                continue
+
             store = mfl.getstorage(tree)
 
-            if not self._matcher.visitdir(store.tree[:-1] or '.'):
+            if not should_visit:
                 # No nodes to send because this directory is out of
                 # the client's view of the repository (probably
-                # because of narrow clones).
+                # because of narrow clones). Do this even for the root
+                # directory (tree=='')
                 prunednodes = []
             else:
                 # Avoid sending any manifest nodes we can prove the
                 # client already has by checking linkrevs. See the
                 # related comment in generatefiles().
                 prunednodes = self._prunemanifests(store, nodes, commonrevs)
+
             if tree and not prunednodes:
                 continue