D1244: overlayworkingctx: invalidate the manifest cache when changing parents

phillco (Phil Cohen) phabricator at mercurial-scm.org
Thu Dec 7 21:23:24 UTC 2017


phillco updated this revision to Diff 4190.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1244?vs=3117&id=4190

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2035,6 +2035,8 @@
     def setbase(self, wrappedctx):
         self._wrappedctx = wrappedctx
         self._parents = [wrappedctx]
+        # Drop old manifest cache:
+        self._invalidate()
 
     def data(self, path):
         if self.isdirty(path):
@@ -2050,6 +2052,13 @@
         else:
             return self._wrappedctx[path].data()
 
+    def _invalidate(self):
+        # Unfortunately, this is necessary when rebasing several nodes with one
+        # ``overlayworkingctx`` (e.g. with --collapse); the manifest can change
+        # and make the cache outdated.
+        self._manifest = None
+        del self.__dict__["_manifest"]
+
     @propertycache
     def _manifest(self):
         parents = self.parents()



To: phillco, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list