diff hgext/fsmonitor/__init__.py @ 44062:2d49482d0dd4

hgext: replace references to hashlib.sha1 with hashutil.sha1 When in a non-pure build of Mercurial, this will provide protections against SHA1 collision attacks. Differential Revision: https://phab.mercurial-scm.org/D7851
author Augie Fackler <augie@google.com>
date Mon, 13 Jan 2020 14:12:31 -0500
parents 90fba2248693
children 9d2b2df2c2ba
line wrap: on
line diff
--- a/hgext/fsmonitor/__init__.py	Mon Jan 13 17:16:54 2020 -0500
+++ b/hgext/fsmonitor/__init__.py	Mon Jan 13 14:12:31 2020 -0500
@@ -108,7 +108,6 @@
 from __future__ import absolute_import
 
 import codecs
-import hashlib
 import os
 import stat
 import sys
@@ -132,7 +131,10 @@
     util,
 )
 from mercurial import match as matchmod
-from mercurial.utils import stringutil
+from mercurial.utils import (
+    hashutil,
+    stringutil,
+)
 
 from . import (
     pywatchman,
@@ -235,7 +237,7 @@
     copy.
 
     """
-    sha1 = hashlib.sha1()
+    sha1 = hashutil.sha1()
     sha1.update(pycompat.byterepr(ignore))
     return pycompat.sysbytes(sha1.hexdigest())