Page MenuHomePhabricator

hashutil: new package for hashing-related features

Authored by durin42 on Jan 13 2020, 5:48 PM.



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.

Diff Detail

rHG Mercurial
No Linters Available
No Unit Test Coverage

Event Timeline

durin42 created this revision.Jan 13 2020, 5:48 PM
indygreg accepted this revision.Jan 13 2020, 11:22 PM
indygreg added a subscriber: indygreg.

I'm not keen on a new module just for 6 lines. But whatever.

This revision is now accepted and ready to land.Jan 13 2020, 11:22 PM
This revision was automatically updated to reflect the committed changes.
pulkit added a subscriber: pulkit.Jan 14 2020, 11:18 AM

Absorbing the following into this patch to make test-check-module-imports.t happy.

diff --git a/mercurial/utils/ b/mercurial/utils/
--- a/mercurial/utils/
+++ b/mercurial/utils/
@@ -3,7 +3,7 @@ from __future__ import absolute_import
 import hashlib
-    from mercurial.thirdparty import sha1dc
+    from ..thirdparty import sha1dc
     sha1 = sha1dc.sha1
 except (ImportError, AttributeError):
     sha1 = hashlib.sha1