Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 47405:34cc102c73f5
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 30 May 2021 16:20:36 +0200 |
parents | 8230f0204eb8 |
children | f7f082bc0e7c |
comparison
equal
deleted
inserted
replaced
47404:53289d02037a | 47405:34cc102c73f5 |
---|---|
165 HAS_FAST_PERSISTENT_NODEMAP = rustrevlog is not None or util.safehasattr( | 165 HAS_FAST_PERSISTENT_NODEMAP = rustrevlog is not None or util.safehasattr( |
166 parsers, 'BaseIndexObject' | 166 parsers, 'BaseIndexObject' |
167 ) | 167 ) |
168 | 168 |
169 | 169 |
170 @attr.s(slots=True, frozen=True) | |
171 class _revisioninfo(object): | |
172 """Information about a revision that allows building its fulltext | |
173 node: expected hash of the revision | |
174 p1, p2: parent revs of the revision | |
175 btext: built text cache consisting of a one-element list | |
176 cachedelta: (baserev, uncompressed_delta) or None | |
177 flags: flags associated to the revision storage | |
178 | |
179 One of btext[0] or cachedelta must be set. | |
180 """ | |
181 | |
182 node = attr.ib() | |
183 p1 = attr.ib() | |
184 p2 = attr.ib() | |
185 btext = attr.ib() | |
186 textlen = attr.ib() | |
187 cachedelta = attr.ib() | |
188 flags = attr.ib() | |
189 | |
190 | |
191 @interfaceutil.implementer(repository.irevisiondelta) | 170 @interfaceutil.implementer(repository.irevisiondelta) |
192 @attr.s(slots=True) | 171 @attr.s(slots=True) |
193 class revlogrevisiondelta(object): | 172 class revlogrevisiondelta(object): |
194 node = attr.ib() | 173 node = attr.ib() |
195 p1node = attr.ib() | 174 p1node = attr.ib() |
2532 textlen = len(rawtext) | 2511 textlen = len(rawtext) |
2533 | 2512 |
2534 if deltacomputer is None: | 2513 if deltacomputer is None: |
2535 deltacomputer = deltautil.deltacomputer(self) | 2514 deltacomputer = deltautil.deltacomputer(self) |
2536 | 2515 |
2537 revinfo = _revisioninfo(node, p1, p2, btext, textlen, cachedelta, flags) | 2516 revinfo = revlogutils.revisioninfo( |
2517 node, | |
2518 p1, | |
2519 p2, | |
2520 btext, | |
2521 textlen, | |
2522 cachedelta, | |
2523 flags, | |
2524 ) | |
2538 | 2525 |
2539 deltainfo = deltacomputer.finddeltainfo(revinfo, fh) | 2526 deltainfo = deltacomputer.finddeltainfo(revinfo, fh) |
2540 | 2527 |
2541 compression_mode = COMP_MODE_INLINE | 2528 compression_mode = COMP_MODE_INLINE |
2542 if self._docket is not None: | 2529 if self._docket is not None: |