Mercurial > public > mercurial-scm > hg-stable
comparison hgext/git/gitlog.py @ 46793: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 | 59fa3890d40a |
children | 048beb0167a7 |
comparison
equal
deleted
inserted
replaced
46792:49fd21f32695 | 46793:6266d19556ad |
---|---|
6 bin, | 6 bin, |
7 hex, | 7 hex, |
8 nullhex, | 8 nullhex, |
9 nullid, | 9 nullid, |
10 nullrev, | 10 nullrev, |
11 sha1nodeconstants, | |
11 wdirhex, | 12 wdirhex, |
12 ) | 13 ) |
13 from mercurial import ( | 14 from mercurial import ( |
14 ancestor, | 15 ancestor, |
15 changelog as hgchangelog, | 16 changelog as hgchangelog, |
420 index._index_repo(self.gitrepo, self._db) | 421 index._index_repo(self.gitrepo, self._db) |
421 return oid.raw | 422 return oid.raw |
422 | 423 |
423 | 424 |
424 class manifestlog(baselog): | 425 class manifestlog(baselog): |
426 nodeconstants = sha1nodeconstants | |
427 | |
425 def __getitem__(self, node): | 428 def __getitem__(self, node): |
426 return self.get(b'', node) | 429 return self.get(b'', node) |
427 | 430 |
428 def get(self, relpath, node): | 431 def get(self, relpath, node): |
429 if node == nullid: | 432 if node == nullid: |