comparison mercurial/revlog.py @ 46780:6266d19556ad

node: introduce nodeconstants class In preparing for moving from SHA1 hashes to a modern hash function, place nullid and other constant magic vules in a class. Provide the active set of constants in the repository and push it down. Provide nullid directly in strategic places like the repository as it is accessed very often. This changeset introduces the API change, but not the mechanical replacement of the node.py attributes itself. Differential Revision: https://phab.mercurial-scm.org/D9750
author Joerg Sonnenberger <joerg@bec.de>
date Wed, 13 Jan 2021 16:14:58 +0100
parents 49fd21f32695
children 9ff4672c8c26
comparison
equal deleted inserted replaced
46779:49fd21f32695 46780:6266d19556ad
26 bin, 26 bin,
27 hex, 27 hex,
28 nullhex, 28 nullhex,
29 nullid, 29 nullid,
30 nullrev, 30 nullrev,
31 sha1nodeconstants,
31 short, 32 short,
32 wdirfilenodeids, 33 wdirfilenodeids,
33 wdirhex, 34 wdirhex,
34 wdirid, 35 wdirid,
35 wdirrev, 36 wdirrev,
649 650
650 else: 651 else:
651 raise error.RevlogError( 652 raise error.RevlogError(
652 _(b'unknown version (%d) in revlog %s') % (fmt, self.indexfile) 653 _(b'unknown version (%d) in revlog %s') % (fmt, self.indexfile)
653 ) 654 )
655
656 self.nodeconstants = sha1nodeconstants
657 self.nullid = self.nodeconstants.nullid
658
654 # sparse-revlog can't be on without general-delta (issue6056) 659 # sparse-revlog can't be on without general-delta (issue6056)
655 if not self._generaldelta: 660 if not self._generaldelta:
656 self._sparserevlog = False 661 self._sparserevlog = False
657 662
658 self._storedeltachains = True 663 self._storedeltachains = True