Mercurial > public > mercurial-scm > hg-stable
diff mercurial/changelog.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 | f63299ee7e4d |
children | d4ba4d51f85f |
line wrap: on
line diff
--- a/mercurial/changelog.py Wed Mar 10 18:09:21 2021 +0100 +++ b/mercurial/changelog.py Wed Jan 13 16:14:58 2021 +0100 @@ -191,7 +191,7 @@ # Extensions might modify _defaultextra, so let the constructor below pass # it in extra = attr.ib() - manifest = attr.ib(default=nullid) + manifest = attr.ib() user = attr.ib(default=b'') date = attr.ib(default=(0, 0)) files = attr.ib(default=attr.Factory(list)) @@ -219,9 +219,9 @@ '_changes', ) - def __new__(cls, text, sidedata, cpsd): + def __new__(cls, cl, text, sidedata, cpsd): if not text: - return _changelogrevision(extra=_defaultextra) + return _changelogrevision(extra=_defaultextra, manifest=nullid) self = super(changelogrevision, cls).__new__(cls) # We could return here and implement the following as an __init__. @@ -526,7 +526,7 @@ """ d, s = self._revisiondata(nodeorrev) c = changelogrevision( - d, s, self._copiesstorage == b'changeset-sidedata' + self, d, s, self._copiesstorage == b'changeset-sidedata' ) return (c.manifest, c.user, c.date, c.files, c.description, c.extra) @@ -534,7 +534,7 @@ """Obtain a ``changelogrevision`` for a node or revision.""" text, sidedata = self._revisiondata(nodeorrev) return changelogrevision( - text, sidedata, self._copiesstorage == b'changeset-sidedata' + self, text, sidedata, self._copiesstorage == b'changeset-sidedata' ) def readfiles(self, nodeorrev):