changeset 51158:e9eac01c57f3 stable

revlog: add a `may_inline` argument to revlog This allow for a clean skipping of the inline feature when needed, for example by censor.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 02 Dec 2023 02:12:21 +0100
parents c136c797740e
children 3e2a878fb96f
files mercurial/revlog.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: