hashutil: new package for hashing-related features
authorAugie Fackler <augie@google.com>
Mon, 13 Jan 2020 17:14:19 -0500
changeset 44059 7126d8b8e0e6
parent 44058 bde1cd4c99d9
child 44060 a61287a95dc3
hashutil: new package for hashing-related features Right now this just tries to use our sha1dc and if it's missing (eg a --pure build) we fall back to hashlib. I imagine in the future we'll want some other things in here for detecting what hasher is in use as we transition off sha1. Differential Revision: https://phab.mercurial-scm.org/D7848
mercurial/utils/hashutil.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mercurial/utils/hashutil.py	Mon Jan 13 17:14:19 2020 -0500
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+
+import hashlib
+
+try:
+    from ..thirdparty import sha1dc
+
+    sha1 = sha1dc.sha1
+except (ImportError, AttributeError):
+    sha1 = hashlib.sha1