D7848: hashutil: new package for hashing-related features

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Mon Jan 13 22:48:14 UTC 2020


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7848

AFFECTED FILES
  mercurial/utils/hashutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/hashutil.py b/mercurial/utils/hashutil.py
new file mode 100644
--- /dev/null
+++ b/mercurial/utils/hashutil.py
@@ -0,0 +1,9 @@
+from __future__ import absolute_import
+
+import hashlib
+
+try:
+    from mercurial.thirdparty import sha1dc
+    sha1 = sha1dc.sha1
+except (ImportError, AttributeError):
+    sha1 = hashlib.sha1



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list