# HG changeset patch # User Pierre-Yves David # Date 1622384436 -7200 # Node ID 34cc102c73f530365efddcc2e36e48e2ea5bb311 # Parent 53289d02037a9c7e31e239b5ea43cf23c53a0405 revlog: move `revisioninfo` in `revlogutils` We will need it in other utility module. So lets extract it from `revlog.py`, the module is too large already anyway. Differential Revision: https://phab.mercurial-scm.org/D10797 diff -r 53289d02037a -r 34cc102c73f5 mercurial/revlog.py --- a/mercurial/revlog.py Sun May 30 17:11:49 2021 +0200 +++ b/mercurial/revlog.py Sun May 30 16:20:36 2021 +0200 @@ -167,27 +167,6 @@ ) -@attr.s(slots=True, frozen=True) -class _revisioninfo(object): - """Information about a revision that allows building its fulltext - node: expected hash of the revision - p1, p2: parent revs of the revision - btext: built text cache consisting of a one-element list - cachedelta: (baserev, uncompressed_delta) or None - flags: flags associated to the revision storage - - One of btext[0] or cachedelta must be set. - """ - - node = attr.ib() - p1 = attr.ib() - p2 = attr.ib() - btext = attr.ib() - textlen = attr.ib() - cachedelta = attr.ib() - flags = attr.ib() - - @interfaceutil.implementer(repository.irevisiondelta) @attr.s(slots=True) class revlogrevisiondelta(object): @@ -2534,7 +2513,15 @@ if deltacomputer is None: deltacomputer = deltautil.deltacomputer(self) - revinfo = _revisioninfo(node, p1, p2, btext, textlen, cachedelta, flags) + revinfo = revlogutils.revisioninfo( + node, + p1, + p2, + btext, + textlen, + cachedelta, + flags, + ) deltainfo = deltacomputer.finddeltainfo(revinfo, fh) diff -r 53289d02037a -r 34cc102c73f5 mercurial/revlogutils/__init__.py --- a/mercurial/revlogutils/__init__.py Sun May 30 17:11:49 2021 +0200 +++ b/mercurial/revlogutils/__init__.py Sun May 30 16:20:36 2021 +0200 @@ -7,6 +7,7 @@ from __future__ import absolute_import +from ..thirdparty import attr from ..interfaces import repository # See mercurial.revlogutils.constants for doc @@ -56,3 +57,24 @@ data_compression_mode, sidedata_compression_mode, ) + + +@attr.s(slots=True, frozen=True) +class revisioninfo(object): + """Information about a revision that allows building its fulltext + node: expected hash of the revision + p1, p2: parent revs of the revision + btext: built text cache consisting of a one-element list + cachedelta: (baserev, uncompressed_delta) or None + flags: flags associated to the revision storage + + One of btext[0] or cachedelta must be set. + """ + + node = attr.ib() + p1 = attr.ib() + p2 = attr.ib() + btext = attr.ib() + textlen = attr.ib() + cachedelta = attr.ib() + flags = attr.ib() diff -r 53289d02037a -r 34cc102c73f5 mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py Sun May 30 17:11:49 2021 +0200 +++ b/mercurial/revlogutils/deltas.py Sun May 30 16:20:36 2021 +0200 @@ -932,7 +932,7 @@ def buildtext(self, revinfo, fh): """Builds a fulltext version of a revision - revinfo: _revisioninfo instance that contains all needed info + revinfo: revisioninfo instance that contains all needed info fh: file handle to either the .i or the .d revlog file, depending on whether it is inlined or not """