changeset 42987:36a0a1951d64

flagprocessors: add a `sidedata` parameters to _processflagswrite To read sidedata using flagprocessors, we need flag processors to store them. So we pass this information to the flag processing layer. Differential Revision: https://phab.mercurial-scm.org/D6815
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 03 Sep 2019 23:51:17 +0200
parents 33532939c667
children f4caf910669e
files hgext/remotefilelog/remotefilelog.py mercurial/revlog.py mercurial/revlogutils/flagutil.py
diffstat 3 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/remotefilelog/remotefilelog.py	Tue Sep 03 23:51:34 2019 +0200
+++ b/hgext/remotefilelog/remotefilelog.py	Tue Sep 03 23:51:17 2019 +0200
@@ -138,7 +138,8 @@
             sidedata = {}
 
         meta, metaoffset = storageutil.parsemeta(text)
-        rawtext, validatehash = self._processflagswrite(text, flags)
+        rawtext, validatehash = self._processflagswrite(text, flags,
+                                                        sidedata=sidedata)
         return self.addrawrevision(rawtext, transaction, linknode, p1, p2,
                                    node, flags, cachedelta,
                                    _metatuple=(meta, metaoffset))
--- a/mercurial/revlog.py	Tue Sep 03 23:51:34 2019 +0200
+++ b/mercurial/revlog.py	Tue Sep 03 23:51:17 2019 +0200
@@ -1842,7 +1842,8 @@
         if flags:
             node = node or self.hash(text, p1, p2)
 
-        rawtext, validatehash = self._processflagswrite(text, flags)
+        rawtext, validatehash = self._processflagswrite(text, flags,
+                                                        sidedata=sidedata)
 
         # If the flag processor modifies the revision data, ignore any provided
         # cachedelta.
--- a/mercurial/revlogutils/flagutil.py	Tue Sep 03 23:51:34 2019 +0200
+++ b/mercurial/revlogutils/flagutil.py	Tue Sep 03 23:51:17 2019 +0200
@@ -120,7 +120,7 @@
         """
         return self._processflagsfunc(text, flags, 'read')
 
-    def _processflagswrite(self, text, flags):
+    def _processflagswrite(self, text, flags, sidedata):
         """Inspect revision data flags and applies write transformations defined
         by registered flag processors.
 
@@ -136,6 +136,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
+        assert not sidedata # XXX until it is actually processed
         return self._processflagsfunc(text, flags, 'write')[:2]
 
     def _processflagsraw(self, text, flags):