Patchwork D10544: revlog: highlight current incompatibility in `rewrite_sidedata`

login
register
mail settings
Submitter phabricator
Date May 2, 2021, 1:29 p.m.
Message ID <differential-rev-PHID-DREV-7ltowg3s5bxvgng3l662-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48863/
State New
Headers show

Comments

phabricator - May 2, 2021, 1:29 p.m.
marmoute created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  See comment for details. We will need to fix the test coverage when this
  incompatibility is lifted.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10544

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS




To: marmoute, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -3211,6 +3211,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: