localrepo: introduce a `_refreshchangelog` method stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 21 Jun 2019 03:50:06 +0200
branchstable
changeset 42510 3472a3f9d785
parent 42509 95c2f951e502
child 42511 044045dce23a
localrepo: introduce a `_refreshchangelog` method See next changeset for usage and documentation for details.
mercurial/bundlerepo.py
mercurial/localrepo.py
--- a/mercurial/bundlerepo.py	Wed Jun 19 17:26:19 2019 +0200
+++ b/mercurial/bundlerepo.py	Fri Jun 21 03:50:06 2019 +0200
@@ -365,6 +365,11 @@
         self.manstart = self._cgunpacker.tell()
         return c
 
+    def _refreshchangelog(self):
+        # changelog for bundle repo are not filecache, this method is not
+        # applicable.
+        pass
+
     @localrepo.unfilteredpropertycache
     def manifestlog(self):
         self._cgunpacker.seek(self.manstart)
--- a/mercurial/localrepo.py	Wed Jun 19 17:26:19 2019 +0200
+++ b/mercurial/localrepo.py	Fri Jun 21 03:50:06 2019 +0200
@@ -1224,6 +1224,11 @@
     def _bookmarks(self):
         return bookmarks.bmstore(self)
 
+    def _refreshchangelog(self):
+        """make sure the in memory changelog match the on-disk one"""
+        if ('changelog' in vars(self) and self.currenttransaction() is None):
+            del self.changelog
+
     @property
     def _activebookmark(self):
         return self._bookmarks.active