Patchwork D2491: narrow: always wrap repo

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2018, 8:56 p.m.
Message ID <differential-rev-PHID-DREV-d34cq3thzswvgtxmqasq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28489/
State Superseded
Headers show

Comments

phabricator - Feb. 28, 2018, 8:56 p.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It's simpler to always wrap the repo. This prepares for moving
  narrowrepo.narrowmatch() onto localrepo by showing that it's now safe
  to always wrap the repo (and thus always define narrowmatch() etc.).
  
  Note that since narrowmatch() returns an always-matcher (rather than
  None) in non-narrow repos, this may mean a performance hit when the
  narrow extension is enabled because it adds a no-op filtering step in
  various places against the always-matcher. I'll restore some of that
  soon.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowcommands.py

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - March 1, 2018, 2:07 a.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  Yay for getting rid of `__bases__` hackery!

REPOSITORY
  rHG Mercurial

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

To: martinvonz, durin42, #hg-reviewers, indygreg
Cc: indygreg, mercurial-devel

Patch

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -30,7 +30,6 @@ 
 
 from . import (
     narrowbundle2,
-    narrowrepo,
 )
 
 table = {}
@@ -101,10 +100,6 @@ 
             '_pullbundle2extraprepare', pullbundle2extraprepare_widen)
 
     def pullnarrow(orig, repo, *args, **kwargs):
-        narrowrepo.wraprepo(repo.unfiltered())
-        if isinstance(repo, repoview.repoview):
-            repo.__class__.__bases__ = (repo.__class__.__bases__[0],
-                                        repo.unfiltered().__class__)
         if opts_narrow:
             repo.requirements.add(changegroup.NARROW_REQUIREMENT)
             repo._writerequirements()
diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -72,8 +72,8 @@ 
     if not isinstance(repo, localrepo.localrepository):
         return
 
+    narrowrepo.wraprepo(repo)
     if changegroup.NARROW_REQUIREMENT in repo.requirements:
-        narrowrepo.wraprepo(repo)
         narrowcopies.setup(repo)
         narrowdirstate.setup(repo)
         narrowpatch.setup(repo)