comparison mercurial/statichttprepo.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 bc2519513ae0
children d4ba4d51f85f
comparison
equal deleted inserted replaced
46779:49fd21f32695 46780:6266d19556ad
10 from __future__ import absolute_import 10 from __future__ import absolute_import
11 11
12 import errno 12 import errno
13 13
14 from .i18n import _ 14 from .i18n import _
15 from .node import sha1nodeconstants
15 from . import ( 16 from . import (
16 branchmap, 17 branchmap,
17 changelog, 18 changelog,
18 error, 19 error,
19 localrepo, 20 localrepo,
196 supportedrequirements = localrepo.gathersupportedrequirements(ui) 197 supportedrequirements = localrepo.gathersupportedrequirements(ui)
197 localrepo.ensurerequirementsrecognized( 198 localrepo.ensurerequirementsrecognized(
198 requirements, supportedrequirements 199 requirements, supportedrequirements
199 ) 200 )
200 localrepo.ensurerequirementscompatible(ui, requirements) 201 localrepo.ensurerequirementscompatible(ui, requirements)
202 self.nodeconstants = sha1nodeconstants
203 self.nullid = self.nodeconstants.nullid
201 204
202 # setup store 205 # setup store
203 self.store = localrepo.makestore(requirements, self.path, vfsclass) 206 self.store = localrepo.makestore(requirements, self.path, vfsclass)
204 self.spath = self.store.path 207 self.spath = self.store.path
205 self.svfs = self.store.opener 208 self.svfs = self.store.opener
206 self.sjoin = self.store.join 209 self.sjoin = self.store.join
207 self._filecache = {} 210 self._filecache = {}
208 self.requirements = requirements 211 self.requirements = requirements
209 212
210 rootmanifest = manifest.manifestrevlog(self.svfs) 213 rootmanifest = manifest.manifestrevlog(self.nodeconstants, self.svfs)
211 self.manifestlog = manifest.manifestlog( 214 self.manifestlog = manifest.manifestlog(
212 self.svfs, self, rootmanifest, self.narrowmatch() 215 self.svfs, self, rootmanifest, self.narrowmatch()
213 ) 216 )
214 self.changelog = changelog.changelog(self.svfs) 217 self.changelog = changelog.changelog(self.svfs)
215 self._tags = None 218 self._tags = None