Patchwork [6,of,7,STABLE] localrepo: introduce a `_refreshchangelog` method

login
register
mail settings
Submitter Pierre-Yves David
Date June 21, 2019, 2:04 a.m.
Message ID <ddd62edfa406e3b84483.1561082653@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/40641/
State Accepted
Headers show

Comments

Pierre-Yves David - June 21, 2019, 2:04 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1561081806 -7200
#      Fri Jun 21 03:50:06 2019 +0200
# Branch stable
# Node ID ddd62edfa406e3b84483cafcaa93927ca917d0cd
# Parent  1646be228b7105c3b0148ae1744802502f872fd9
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ddd62edfa406
localrepo: introduce a `_refreshchangelog` method

See next changeset for usage and documentation for details.
Yuya Nishihara - June 22, 2019, 2:55 a.m.
On Fri, 21 Jun 2019 04:04:13 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1561081806 -7200
> #      Fri Jun 21 03:50:06 2019 +0200
> # Branch stable
> # Node ID ddd62edfa406e3b84483cafcaa93927ca917d0cd
> # Parent  1646be228b7105c3b0148ae1744802502f872fd9
> # EXP-Topic book-del-stable
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r ddd62edfa406
> localrepo: introduce a `_refreshchangelog` method

The series looks good and appears to be ninja queued.

> +    def _refreshchangelog(self):
> +        """make sure the in memory changelog match the on-disk one"""
> +        if ('changelog' in vars(self) and self.currenttransaction() is None):

r'changelog' for py3.

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -365,6 +365,11 @@  class bundlerepository(object):
         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)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,6 +1224,11 @@  class localrepository(object):
     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