[PATCH 5 of 7] revlog: add some documentation to `_revisiondata` code

Yuya Nishihara yuya at tcha.org
Wed Aug 21 08:36:03 EDT 2019


On Tue, 20 Aug 2019 18:37:30 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at octobus.net>
> # Date 1565214901 -7200
> #      Wed Aug 07 23:55:01 2019 +0200
> # Node ID b8286cf6ab132b2d132e1565bc7bc100b4c69596
> # Parent  8dd3d57f5d4780a1c8e6aeccc78c54c856999215
> # EXP-Topic revisiondata
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b8286cf6ab13
> revlog: add some documentation to `_revisiondata` code
> 
> diff --git a/mercurial/revlog.py b/mercurial/revlog.py
> --- a/mercurial/revlog.py
> +++ b/mercurial/revlog.py
> @@ -1611,6 +1611,7 @@ class revlog(object):
>          return self._revisiondata(nodeorrev, _df, raw=raw)
>  
>      def _revisiondata(self, nodeorrev, _df=None, raw=False):
> +        # deal with <nodeorrev> argument type
>          if isinstance(nodeorrev, int):
>              rev = nodeorrev
>              node = self.node(rev)
> @@ -1618,19 +1619,31 @@ class revlog(object):
>              node = nodeorrev
>              rev = None
>  
> +        # fast path the special `nullid` rev
>          if node == nullid:
>              return ""
>  
> +        # revision in the cache (could be useful to apply delta)
>          cachedrev = None
> +        # the revlog's flag for this revision
> +        # (usually alter its state or content)
>          flags = None
> +        # The text as stored inside the revlog. Might be the revision or might
> +        # need to be processed to retrieve the revision.
>          rawtext = None
> +        # An intermediate text to apply deltas to
>          basetext = None
> +
> +        # Check is we are the entry in cache

s/is/if/, s/are/have/

> +        # The cache entry looks like (node, rev, rawtext)
>          if self._revisioncache:
>              if self._revisioncache[0] == node:
>                  # _cache only stores rawtext
>                  # rawtext is reusable. but we might need to run flag processors
>                  rawtext = self._revisioncache[2]
>                  if raw:
> +                    # if we are don't want to process the raw text and that raw

s/are//


More information about the Mercurial-devel mailing list