rawdata: introduce a `rawdata` method on revlog
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Aug 2019 21:54:29 +0200
changeset 42719 415e4136d326
parent 42718 389233789952
child 42720 bf1e8d2ab900
rawdata: introduce a `rawdata` method on revlog This method aims at replacing `revision(..., raw=True)` call. The purpose of data returned without and without raw are different enough that having two different method would make sense. This split is motivated by other work aiming at storing data on the side of the main revision of a revlog. Having a cleaner API makes it simpler to add this work. The series following this first changesets is organised as follow: 1) add `rawdata` method everywhere it is useful 2) update all caller 3) implement all `rawdata` method without using `revision` 4) deprecate the `rawdata` parameter of `revision`
mercurial/revlog.py
--- a/mercurial/revlog.py	Wed Aug 07 17:14:48 2019 +0200
+++ b/mercurial/revlog.py	Wed Aug 07 21:54:29 2019 +0200
@@ -1720,6 +1720,13 @@
 
         return text
 
+    def rawdata(self, nodeorrev, _df=None, raw=False):
+        """return an uncompressed raw data of a given node or revision number.
+
+        _df - an existing file handle to read from. (internal-only)
+        """
+        return self._revisiondata(nodeorrev, _df, raw=True)
+
     def hash(self, text, p1, p2):
         """Compute a node hash.