diff mercurial/revlogutils/rewrite.py @ 51159:3e2a878fb96f stable

censor: fix things around inlining The temporary revlog cannot go through the inline → split process as this would break at transaction commit. (that might be fixable, but lets keep things simple for now). We introduce a cleaner way to enforce this as the previous one was broken in 6.6 On the way we remove multiple weird, fragile and broken overwrite of revlog attributes and we focus on passing the configuration across. We also had to update the test to actually create a non-inline revlog.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 02 Dec 2023 02:13:23 +0100
parents 9c8df10ea6e0
children ceeb8fa23cc8
line wrap: on
line diff
--- a/mercurial/revlogutils/rewrite.py	Sat Dec 02 02:12:21 2023 +0100
+++ b/mercurial/revlogutils/rewrite.py	Sat Dec 02 02:13:23 2023 +0100
@@ -72,11 +72,16 @@
         radix=rl.radix,
         postfix=b'tmpcensored',
         censorable=True,
+        data_config=rl.data_config,
+        delta_config=rl.delta_config,
+        feature_config=rl.feature_config,
+        may_inline=rl._inline,
     )
-    newrl._format_version = rl._format_version
-    newrl._format_flags = rl._format_flags
-    newrl.delta_config.general_delta = rl.delta_config.general_delta
-    newrl._parse_index = rl._parse_index
+    # inline splitting will prepare some transaction work that will get
+    # confused by the final file move. So if there is a risk of not being
+    # inline at the end, we prevent the new revlog to be inline in the first
+    # place.
+    assert not (newrl._inline and not rl._inline)
 
     for rev in rl.revs():
         node = rl.node(rev)
@@ -122,7 +127,10 @@
         tr.addbackup(rl._datafile, location=b'store')
 
     rl.opener.rename(newrl._indexfile, rl._indexfile)
-    if not rl._inline:
+    if newrl._inline:
+        assert rl._inline
+    else:
+        assert not rl._inline
         rl.opener.rename(newrl._datafile, rl._datafile)
 
     rl.clearcaches()