Patchwork D1244: overlayworkingctx: invalidate the manifest cache when changing parents

login
register
mail settings
Submitter phabricator
Date Dec. 7, 2017, 9:52 p.m.
Message ID <76bb92f0bc8a164fb99c8433d9bbe293@localhost.localdomain>
Download mbox | patch
Permalink /patch/26051/
State Not Applicable
Headers show

Comments

phabricator - Dec. 7, 2017, 9:52 p.m.
phillco updated this revision to Diff 4217.

REPOSITORY
  rHG Mercurial

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

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1999,6 +1999,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):
@@ -2014,6 +2016,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()