changeset 47134:1b33e38d4b6d

revlog: highlight current incompatibility in `rewrite_sidedata` See comment for details. We will need to fix the test coverage when this incompatibility is lifted. Differential Revision: https://phab.mercurial-scm.org/D10544
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 03 May 2021 12:18:58 +0200
parents 5e5fad5166e6
children 1352cc14cce2
files mercurial/revlog.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Mon May 03 12:18:48 2021 +0200
+++ b/mercurial/revlog.py	Mon May 03 12:18:58 2021 +0200
@@ -3082,6 +3082,18 @@
             # Nothing to generate or remove
             return
 
+        # changelog implement some "delayed" writing mechanism that assume that
+        # all index data is writen in append mode and is therefor incompatible
+        # with the seeked write done in this method. The use of such "delayed"
+        # writing will soon be removed for revlog version that support side
+        # data, so for now, we only keep this simple assert to highlight the
+        # situation.
+        delayed = getattr(self, '_delayed', False)
+        diverted = getattr(self, '_divert', False)
+        if delayed and not diverted:
+            msg = "cannot rewrite_sidedata of a delayed revlog"
+            raise error.ProgrammingError(msg)
+
         new_entries = []
         # append the new sidedata
         with self._datafp(b'a+') as fp: