revlog: add a `may_inline` argument to revlog stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 02 Dec 2023 02:12:21 +0100
branchstable
changeset 51158 e9eac01c57f3
parent 51157 c136c797740e
child 51159 3e2a878fb96f
revlog: add a `may_inline` argument to revlog This allow for a clean skipping of the inline feature when needed, for example by censor.
mercurial/revlog.py
--- a/mercurial/revlog.py	Sat Dec 02 02:11:20 2023 +0100
+++ b/mercurial/revlog.py	Sat Dec 02 02:12:21 2023 +0100
@@ -1308,6 +1308,7 @@
         data_config=None,
         delta_config=None,
         feature_config=None,
+        may_inline=True,  # may inline new revlog
     ):
         """
         create a revlog object
@@ -1333,6 +1334,7 @@
         self.postfix = postfix
         self._trypending = trypending
         self._try_split = try_split
+        self._may_inline = may_inline
         self.opener = opener
         if persistentnodemap:
             self._nodemap_file = nodemaputil.get_nodemap_file(self)
@@ -1598,7 +1600,9 @@
         elif b'revlogv2' in opts:
             new_header = REVLOGV2
         elif b'revlogv1' in opts:
-            new_header = REVLOGV1 | FLAG_INLINE_DATA
+            new_header = REVLOGV1
+            if self._may_inline:
+                new_header |= FLAG_INLINE_DATA
             if b'generaldelta' in opts:
                 new_header |= FLAG_GENERALDELTA
         elif b'revlogv0' in self.opener.options: