revlog: add a `sidedata` parameters to addrevision
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 03 Sep 2019 23:51:34 +0200
changeset 42986 33532939c667
parent 42985 bd5858c28bbe
child 42987 36a0a1951d64
revlog: add a `sidedata` parameters to addrevision If we want to eventually store sidedata we need to be able to pass them along. Differential Revision: https://phab.mercurial-scm.org/D6814
hgext/remotefilelog/remotefilelog.py
mercurial/revlog.py
--- a/hgext/remotefilelog/remotefilelog.py	Wed Sep 04 00:34:03 2019 +0200
+++ b/hgext/remotefilelog/remotefilelog.py	Tue Sep 03 23:51:34 2019 +0200
@@ -129,10 +129,13 @@
         return data
 
     def addrevision(self, text, transaction, linknode, p1, p2, cachedelta=None,
-                    node=None, flags=revlog.REVIDX_DEFAULT_FLAGS):
+                    node=None, flags=revlog.REVIDX_DEFAULT_FLAGS,
+                    sidedata=None):
         # text passed to "addrevision" includes hg filelog metadata header
         if node is None:
             node = storageutil.hashrevisionsha1(text, p1, p2)
+        if sidedata is None:
+            sidedata = {}
 
         meta, metaoffset = storageutil.parsemeta(text)
         rawtext, validatehash = self._processflagswrite(text, flags)
--- a/mercurial/revlog.py	Wed Sep 04 00:34:03 2019 +0200
+++ b/mercurial/revlog.py	Tue Sep 03 23:51:34 2019 +0200
@@ -1816,7 +1816,8 @@
         """
 
     def addrevision(self, text, transaction, link, p1, p2, cachedelta=None,
-                    node=None, flags=REVIDX_DEFAULT_FLAGS, deltacomputer=None):
+                    node=None, flags=REVIDX_DEFAULT_FLAGS, deltacomputer=None,
+                    sidedata=None):
         """add a revision to the log
 
         text - the revision data to add
@@ -1835,6 +1836,9 @@
             raise error.RevlogError(_("attempted to add linkrev -1 to %s")
                                     % self.indexfile)
 
+        if sidedata is None:
+            sidedata = {}
+
         if flags:
             node = node or self.hash(text, p1, p2)