diff mercurial/revlog.py @ 51635:1721d983dd6d stable

inline-changelog: fix pending transaction visibility when splitting We move the name back to the expected name of `changelog.i.a`.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 12 Jun 2024 02:16:14 +0200
parents 3cf9e52f5e27
children d6c895e4adc4
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Jun 12 02:15:20 2024 +0200
+++ b/mercurial/revlog.py	Wed Jun 12 02:16:14 2024 +0200
@@ -1148,7 +1148,14 @@
         )
 
     def _divert_index(self):
-        return self.index_file + b'.a'
+        index_file = self.index_file
+        # when we encounter a legacy inline-changelog, split it. However it is
+        # important to use the expected filename for pending content
+        # (<radix>.a) otherwise hooks won't be seeing the content of the
+        # pending transaction.
+        if index_file.endswith(b'.s'):
+            index_file = self.index_file[:-2]
+        return index_file + b'.a'
 
     def delay(self):
         assert not self.is_open