Patchwork [02,of,10] rawdata: introduce a `rawdata` method on revlog

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 7, 2019, 9:30 p.m.
Message ID <fe5517914e9f519855d5.1565213431@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/41204/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 7, 2019, 9:30 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1565207669 -7200
#      Wed Aug 07 21:54:29 2019 +0200
# Node ID fe5517914e9f519855d5f8c0ef89098e039d68c6
# Parent  3b49bb04851ea501f005e7a58403fee3b1c52958
# EXP-Topic rawdata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fe5517914e9f
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`
Yuya Nishihara - Aug. 18, 2019, 3:49 a.m.
On Wed, 07 Aug 2019 23:30:31 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@octobus.net>
> # Date 1565207669 -7200
> #      Wed Aug 07 21:54:29 2019 +0200
> # Node ID fe5517914e9f519855d5f8c0ef89098e039d68c6
> # Parent  3b49bb04851ea501f005e7a58403fee3b1c52958
> # EXP-Topic rawdata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fe5517914e9f
> 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`
> 
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1720,6 +1720,13 @@ class revlog(object):
>  
>          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)

Just curious. What does rawdata(raw=False|True) mean?

Patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1720,6 +1720,13 @@  class revlog(object):
 
         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.