Mercurial > hg
comparison mercurial/revlog.py @ 43526:e258ad110488
revlog: no longer return the nodemap after parsing
Now that both pure and cext version have a `nodemap` attribute, we do not need
to return the `nodemap` object after parsing.
This work is part of a refactoring to unify the revlog index and the nodemap.
This unification prepare the use of a persistent nodemap.
Differential Revision: https://phab.mercurial-scm.org/D7314
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 06 Nov 2019 14:13:19 +0100 |
parents | 845e5b313783 |
children | 90a0f631829e |
comparison
equal
deleted
inserted
replaced
43525:845e5b313783 | 43526:e258ad110488 |
---|---|
250 index.append(e2) | 250 index.append(e2) |
251 nodemap[e[6]] = n | 251 nodemap[e[6]] = n |
252 n += 1 | 252 n += 1 |
253 | 253 |
254 index = revlogoldindex(index) | 254 index = revlogoldindex(index) |
255 return index, index.nodemap, None | 255 return index, None |
256 | 256 |
257 def packentry(self, entry, node, version, rev): | 257 def packentry(self, entry, node, version, rev): |
258 if gettype(entry[0]): | 258 if gettype(entry[0]): |
259 raise error.RevlogError( | 259 raise error.RevlogError( |
260 _(b'index entry flags need revlog version 1') | 260 _(b'index entry flags need revlog version 1') |
297 self.size = indexformatng.size | 297 self.size = indexformatng.size |
298 | 298 |
299 def parseindex(self, data, inline): | 299 def parseindex(self, data, inline): |
300 # call the C implementation to parse the index data | 300 # call the C implementation to parse the index data |
301 index, cache = parsers.parse_index2(data, inline) | 301 index, cache = parsers.parse_index2(data, inline) |
302 return index, index.nodemap, cache | 302 return index, cache |
303 | 303 |
304 def packentry(self, entry, node, version, rev): | 304 def packentry(self, entry, node, version, rev): |
305 p = indexformatng_pack(*entry) | 305 p = indexformatng_pack(*entry) |
306 if rev == 0: | 306 if rev == 0: |
307 p = versionformat_pack(version) + p[4:] | 307 p = versionformat_pack(version) + p[4:] |
550 d = self._io.parseindex(indexdata, self._inline) | 550 d = self._io.parseindex(indexdata, self._inline) |
551 except (ValueError, IndexError): | 551 except (ValueError, IndexError): |
552 raise error.RevlogError( | 552 raise error.RevlogError( |
553 _(b"index %s is corrupted") % self.indexfile | 553 _(b"index %s is corrupted") % self.indexfile |
554 ) | 554 ) |
555 self.index, nodemap, self._chunkcache = d | 555 self.index, self._chunkcache = d |
556 self.nodemap = self._nodecache = nodemap | 556 self.nodemap = self._nodecache = self.index.nodemap |
557 if not self._chunkcache: | 557 if not self._chunkcache: |
558 self._chunkclear() | 558 self._chunkclear() |
559 # revnum -> (chain-length, sum-delta-length) | 559 # revnum -> (chain-length, sum-delta-length) |
560 self._chaininfocache = {} | 560 self._chaininfocache = {} |
561 # revlog header -> revlog compressor | 561 # revlog header -> revlog compressor |