##// END OF EJS Templates
revlog: use hashlib.sha1 directly instead of through util...
Augie Fackler -
r29339:a9e010cd default
parent child Browse files
Show More
@@ -15,6 +15,7 b' from __future__ import absolute_import'
15
15
16 import collections
16 import collections
17 import errno
17 import errno
18 import hashlib
18 import os
19 import os
19 import struct
20 import struct
20 import zlib
21 import zlib
@@ -40,7 +41,6 b' from . import ('
40 _unpack = struct.unpack
41 _unpack = struct.unpack
41 _compress = zlib.compress
42 _compress = zlib.compress
42 _decompress = zlib.decompress
43 _decompress = zlib.decompress
43 _sha = util.sha1
44
44
45 # revlog header flags
45 # revlog header flags
46 REVLOGV0 = 0
46 REVLOGV0 = 0
@@ -74,7 +74,7 b' def gettype(q):'
74 def offset_type(offset, type):
74 def offset_type(offset, type):
75 return long(long(offset) << 16 | type)
75 return long(long(offset) << 16 | type)
76
76
77 _nullhash = _sha(nullid)
77 _nullhash = hashlib.sha1(nullid)
78
78
79 def hash(text, p1, p2):
79 def hash(text, p1, p2):
80 """generate a hash from the given text and its parent hashes
80 """generate a hash from the given text and its parent hashes
@@ -92,7 +92,7 b' def hash(text, p1, p2):'
92 # none of the parent nodes are nullid
92 # none of the parent nodes are nullid
93 l = [p1, p2]
93 l = [p1, p2]
94 l.sort()
94 l.sort()
95 s = _sha(l[0])
95 s = hashlib.sha1(l[0])
96 s.update(l[1])
96 s.update(l[1])
97 s.update(text)
97 s.update(text)
98 return s.digest()
98 return s.digest()
General Comments 0
You need to be logged in to leave comments. Login now