changeset 30341:3dfb5a0171c9

manifestctx: add _revlog() function The `self._repo.manifestlog._revlog` code is getting copy and pasted a lot in manifestctx. Let's make it a function so it can be reused. This will make future patches cleaner too.
author Durham Goode <durham@fb.com>
date Tue, 08 Nov 2016 08:03:43 -0800
parents 608ba935e041
children fe1ee393de78
files mercurial/manifest.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Tue Nov 08 08:03:43 2016 -0800
+++ b/mercurial/manifest.py	Tue Nov 08 08:03:43 2016 -0800
@@ -1340,6 +1340,9 @@
         #rev = revlog.rev(node)
         #self.linkrev = revlog.linkrev(rev)
 
+    def _revlog(self):
+        return self._repo.manifestlog._revlog
+
     def node(self):
         return self._node
 
@@ -1348,7 +1351,7 @@
             if self._node == revlog.nullid:
                 self._data = manifestdict()
             else:
-                rl = self._repo.manifestlog._revlog
+                rl = self._revlog()
                 text = rl.revision(self._node)
                 arraytext = array.array('c', text)
                 rl._fulltextcache[self._node] = arraytext
@@ -1362,7 +1365,7 @@
 
         If `shallow` is True, nothing changes since this is a flat manifest.
         '''
-        rl = self._repo.manifestlog._revlog
+        rl = self._revlog()
         r = rl.rev(self._node)
         deltaparent = rl.deltaparent(r)
         if deltaparent != revlog.nullrev and deltaparent in rl.parentrevs(r):
@@ -1376,7 +1379,7 @@
 
         Changing the value of `shallow` has no effect on flat manifests.
         '''
-        revlog = self._repo.manifestlog._revlog
+        revlog = self._revlog()
         if revlog._usemanifestv2:
             # Need to perform a slow delta
             r0 = revlog.deltaparent(revlog.rev(self._node))