annotate mercurial/utils/hashutil.py @ 46858:85e3a630cad9

revlog: move the details of revlog "v2" index inside revlog.utils.constants the revlog module is quite large and this kind of format information would handy for other module. So let us start to gather this information about the format in a more appropriate place. We update various reference to this information to use the new "source of truth" in the process. Differential Revision: https://phab.mercurial-scm.org/D10305
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Apr 2021 12:21:12 +0200
parents 521ac0d7047f
children 6000f5b25c9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
44059
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
1 from __future__ import absolute_import
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
2
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
3 import hashlib
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
4
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
5 try:
46785
521ac0d7047f typing: disable import error warnings that are already handled
Matt Harbison <matt_harbison@yahoo.com>
parents: 44059
diff changeset
6 from ..thirdparty import sha1dc # pytype: disable=import-error
44059
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
7
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
8 sha1 = sha1dc.sha1
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
9 except (ImportError, AttributeError):
7126d8b8e0e6 hashutil: new package for hashing-related features
Augie Fackler <augie@google.com>
parents:
diff changeset
10 sha1 = hashlib.sha1