changeset 51638: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 a1a011d4b148
files mercurial/revlog.py tests/test-split-legacy-inline-changelog.t
diffstat 2 files changed, 11 insertions(+), 8 deletions(-) [+]
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
--- a/tests/test-split-legacy-inline-changelog.t	Wed Jun 12 02:15:20 2024 +0200
+++ b/tests/test-split-legacy-inline-changelog.t	Wed Jun 12 02:16:14 2024 +0200
@@ -98,9 +98,7 @@
   $ echo b > b
   $ hg add b
   $ hg commit -m "second changeset"
-  pre-txn tip rev: 1 (missing-correct-output !)
-  warning: ignoring unknown working parent 11b63e930bf2! (known-bad-output !)
-  pre-txn tip rev: 0 (known-bad-output !)
+  pre-txn tip rev: 1
   $ hg verify
   checking changesets
   checking manifests
@@ -195,8 +193,7 @@
   adding changesets
   adding manifests
   adding file changes
-  pre-txn tip rev: 1 (missing-correct-output !)
-  pre-txn tip rev: 0 (known-bad-output !)
+  pre-txn tip rev: 1
   added 1 changesets with 1 changes to 1 files
   $ cd ..
 
@@ -289,8 +286,7 @@
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
-  remote: pre-txn tip rev: 1 (missing-correct-output !)
-  remote: pre-txn tip rev: 0 (known-bad-output !)
+  remote: pre-txn tip rev: 1
   remote: added 1 changesets with 1 changes to 1 files
   $ cd ..