diff mercurial/revlog.py @ 43030:827cb4fe62a3

sidedata: introduce a new requirement to protect the feature The feature will be usable only within repository supported by version of Mercurial with the support. Since the support is not fully implemented yet, the requirement has a temporary, experimental name. Differential Revision: https://phab.mercurial-scm.org/D6886
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 09 Sep 2019 22:42:55 +0200
parents 3518da504303
children 294afb982a88
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Sep 25 03:58:46 2019 +0200
+++ b/mercurial/revlog.py	Mon Sep 09 22:42:55 2019 +0200
@@ -388,6 +388,7 @@
             self._maxdeltachainspan = opts['maxdeltachainspan']
         if self._mmaplargeindex and 'mmapindexthreshold' in opts:
             mmapindexthreshold = opts['mmapindexthreshold']
+        self.hassidedata = bool(opts.get('side-data', False))
         self._sparserevlog = bool(opts.get('sparse-revlog', False))
         withsparseread = bool(opts.get('with-sparse-read', False))
         # sparse-revlog forces sparse-read
@@ -1849,6 +1850,10 @@
 
         if sidedata is None:
             sidedata = {}
+        elif not self.hassidedata:
+            raise error.ProgrammingError(
+                _("trying to add sidedata to a revlog who don't support them")
+                )
 
         if flags:
             node = node or self.hash(text, p1, p2)