D3045: narrow: move manifestrevlog overrides to core
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Apr 5 14:03:33 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc50078fc32f3: narrow: move manifestrevlog overrides to core (authored by martinvonz, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3045?vs=7576&id=7744
REVISION DETAIL
https://phab.mercurial-scm.org/D3045
AFFECTED FILES
hgext/narrow/narrowrepo.py
hgext/narrow/narrowrevlog.py
mercurial/manifest.py
CHANGE DETAILS
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1279,6 +1279,7 @@
self._treeinmem = usetreemanifest
self._revlog = repo._constructmanifest()
+ self._narrowmatch = repo.narrowmatch()
# A cache of the manifestctx or treemanifestctx for each directory
self._dirmancache = {}
@@ -1477,6 +1478,10 @@
#self.linkrev = revlog.linkrev(rev)
def _revlog(self):
+ narrowmatch = self._manifestlog._narrowmatch
+ if not narrowmatch.always():
+ if not narrowmatch.visitdir(self._dir[:-1] or '.'):
+ return excludedmanifestrevlog(self._dir)
return self._manifestlog._revlog.dirlog(self._dir)
def read(self):
diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py
--- a/hgext/narrow/narrowrevlog.py
+++ b/hgext/narrow/narrowrevlog.py
@@ -30,24 +30,6 @@
# load time.
pass
-def makenarrowmanifestrevlog(mfrevlog, repo):
- if util.safehasattr(mfrevlog, '_narrowed'):
- return
-
- class narrowmanifestrevlog(mfrevlog.__class__):
- # This function is called via debug{revlog,index,data}, but also during
- # at least some push operations. This will be used to wrap/exclude the
- # child directories when using treemanifests.
- def dirlog(self, d):
- if not repo.narrowmatch().visitdir(d[:-1] or '.'):
- return manifest.excludedmanifestrevlog(d)
- result = super(narrowmanifestrevlog, self).dirlog(d)
- makenarrowmanifestrevlog(result, repo)
- return result
-
- mfrevlog.__class__ = narrowmanifestrevlog
- mfrevlog._narrowed = True
-
def makenarrowmanifestlog(mfl, repo):
class narrowmanifestlog(mfl.__class__):
def get(self, dir, node, verify=True):
diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py
--- a/hgext/narrow/narrowrepo.py
+++ b/hgext/narrow/narrowrepo.py
@@ -50,11 +50,6 @@
class narrowrepository(repo.__class__):
- def _constructmanifest(self):
- manifest = super(narrowrepository, self)._constructmanifest()
- narrowrevlog.makenarrowmanifestrevlog(manifest, repo)
- return manifest
-
@cacheprop('00manifest.i')
def manifestlog(self):
mfl = super(narrowrepository, self).manifestlog
To: martinvonz, durin42, #hg-reviewers, indygreg
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list