[PATCH 02 of 10] manifest: remove usages of manifest.read

Durham Goode durham at fb.com
Fri Nov 11 04:26:09 EST 2016


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1478772799 28800
#      Thu Nov 10 02:13:19 2016 -0800
# Node ID 72b6741828a215f4608402025ab9f1938a47fd90
# Parent  f77a36aa659c05ac34740046ac6b02e77895bb37
manifest: remove usages of manifest.read

Now that the two manifestctx implementations have working read() functions,
let's remove the existing uses of manifest.read and drop the function.

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -567,7 +567,7 @@ def perfmanifest(ui, repo, rev, **opts):
     t = ctx.manifestnode()
     def d():
         repo.manifest.clearcaches()
-        repo.manifest.read(t)
+        repo.manifestlog[t].read()
     timer(d)
     fm.end()
 
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1660,7 +1660,7 @@ class queue(object):
             # caching against the next repo.status call
             mm, aa, dd = repo.status(patchparent, top)[:3]
             changes = repo.changelog.read(top)
-            man = repo.manifest.read(changes[0])
+            man = repo.manifestlog[changes[0]].read()
             aaa = aa[:]
             matchfn = scmutil.match(repo[None], pats, opts)
             # in short mode, we only diff the files included in the
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1594,33 +1594,6 @@ class manifest(manifestrevlog):
                                               self._dirlogcache)
         return self._dirlogcache[dir]
 
-    def read(self, node):
-        if node == revlog.nullid:
-            return self._newmanifest() # don't upset local cache
-        if node in self._mancache:
-            cached = self._mancache[node]
-            if (isinstance(cached, manifestctx) or
-                isinstance(cached, treemanifestctx)):
-                cached = cached.read()
-            return cached
-        if self._treeondisk:
-            def gettext():
-                return self.revision(node)
-            def readsubtree(dir, subm):
-                return self.dirlog(dir).read(subm)
-            m = self._newmanifest()
-            m.read(gettext, readsubtree)
-            m.setnode(node)
-            arraytext = None
-        else:
-            text = self.revision(node)
-            m = self._newmanifest(text)
-            arraytext = array.array('c', text)
-        self._mancache[node] = m
-        if arraytext is not None:
-            self.fulltextcache[node] = arraytext
-        return m
-
     def clearcaches(self):
         super(manifest, self).clearcaches()
         self._mancache.clear()


More information about the Mercurial-devel mailing list