changeset 29339:a9e010cd66e1

revlog: use hashlib.sha1 directly instead of through util Also remove module-local _sha alias, which was barely used.
author Augie Fackler <raf@durin42.com>
date Fri, 10 Jun 2016 00:10:34 -0400
parents 81c38cb9c1a1
children ae92c3eee88e
files mercurial/revlog.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Fri Jun 10 00:10:06 2016 -0400
+++ b/mercurial/revlog.py	Fri Jun 10 00:10:34 2016 -0400
@@ -15,6 +15,7 @@
 
 import collections
 import errno
+import hashlib
 import os
 import struct
 import zlib
@@ -40,7 +41,6 @@
 _unpack = struct.unpack
 _compress = zlib.compress
 _decompress = zlib.decompress
-_sha = util.sha1
 
 # revlog header flags
 REVLOGV0 = 0
@@ -74,7 +74,7 @@
 def offset_type(offset, type):
     return long(long(offset) << 16 | type)
 
-_nullhash = _sha(nullid)
+_nullhash = hashlib.sha1(nullid)
 
 def hash(text, p1, p2):
     """generate a hash from the given text and its parent hashes
@@ -92,7 +92,7 @@
         # none of the parent nodes are nullid
         l = [p1, p2]
         l.sort()
-        s = _sha(l[0])
+        s = hashlib.sha1(l[0])
         s.update(l[1])
     s.update(text)
     return s.digest()