diff mercurial/localrepo.py @ 33732:01a1c4e66816

repo: skip invalidation of changelog if it has 'delayed' changes (API) The changelog object can store recently added revisions in memory until the transaction is committed. We don't want to lose those changes even if repo.invalidate(clearfilecache=True), so let's skip the changelog when it has such 'delayed' changes. Differential Revision: https://phab.mercurial-scm.org/D152
author Martin von Zweigbergk <martinvonz@google.com>
date Wed, 19 Jul 2017 13:34:06 -0700
parents da3087b8f4a2
children 02a745c20121
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Aug 06 17:47:41 2017 -0700
+++ b/mercurial/localrepo.py	Wed Jul 19 13:34:06 2017 -0700
@@ -1461,6 +1461,13 @@
             # dirstate is invalidated separately in invalidatedirstate()
             if k == 'dirstate':
                 continue
+            if (k == 'changelog' and
+                self.currenttransaction() and
+                self.changelog._delayed):
+                # The changelog object may store unwritten revisions. We don't
+                # want to lose them.
+                # TODO: Solve the problem instead of working around it.
+                continue
 
             if clearfilecache:
                 del self._filecache[k]