Patchwork [6,of,7] context: add manifestctx property on changectx

login
register
mail settings
Submitter Durham Goode
Date Nov. 8, 2016, 4:43 p.m.
Message ID <05bf15311d25783de82d.1478623380@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17408/
State Accepted
Headers show

Comments

Durham Goode - Nov. 8, 2016, 4:43 p.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1478621023 28800
#      Tue Nov 08 08:03:43 2016 -0800
# Node ID 05bf15311d25783de82dcbe0f93df5963b504357
# Parent  30637bdf444e47e38edef0bc52c9ffe313816c66
context: add manifestctx property on changectx

This allows us to access the manifestctx for a given commit. This will be used
in a later patch to be able to copy the manifestctx when we want to make a new
commit.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -178,6 +178,8 @@  class basectx(object):
         return hex(self.node())
     def manifest(self):
         return self._manifest
+    def manifestctx(self):
+        return self._manifestctx
     def repo(self):
         return self._repo
     def phasestr(self):
@@ -530,12 +532,15 @@  class changectx(basectx):
 
     @propertycache
     def _manifest(self):
-        return self._repo.manifestlog[self._changeset.manifest].read()
+        return self._manifestctx.read()
+
+    @propertycache
+    def _manifestctx(self):
+        return self._repo.manifestlog[self._changeset.manifest]
 
     @propertycache
     def _manifestdelta(self):
-        mfnode = self._changeset.manifest
-        return self._repo.manifestlog[mfnode].readdelta()
+        return self._manifestctx.readdelta()
 
     @propertycache
     def _parents(self):