comparison mercurial/repoview.py @ 29341:0d83ad967bf8

cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 All versions of Python we support or hope to support make the hash functions available in the same way under the same name, so we may as well drop the util forwards.
author Augie Fackler <raf@durin42.com>
date Fri, 10 Jun 2016 00:12:33 -0400
parents a4dc5fe7bf54
children 20027be9f23d
comparison
equal deleted inserted replaced
29340:ae92c3eee88e 29341:0d83ad967bf8
7 # GNU General Public License version 2 or any later version. 7 # GNU General Public License version 2 or any later version.
8 8
9 from __future__ import absolute_import 9 from __future__ import absolute_import
10 10
11 import copy 11 import copy
12 import hashlib
12 import heapq 13 import heapq
13 import struct 14 import struct
14 15
15 from .node import nullrev 16 from .node import nullrev
16 from . import ( 17 from . import (
17 error, 18 error,
18 obsolete, 19 obsolete,
19 phases, 20 phases,
20 tags as tagsmod, 21 tags as tagsmod,
21 util,
22 ) 22 )
23 23
24 def hideablerevs(repo): 24 def hideablerevs(repo):
25 """Revision candidates to be hidden 25 """Revision candidates to be hidden
26 26
100 100
101 We calculate a sha1 of repo heads and the content of the obsstore and write 101 We calculate a sha1 of repo heads and the content of the obsstore and write
102 it to the cache. Upon reading we can easily validate by checking the hash 102 it to the cache. Upon reading we can easily validate by checking the hash
103 against the stored one and discard the cache in case the hashes don't match. 103 against the stored one and discard the cache in case the hashes don't match.
104 """ 104 """
105 h = util.sha1() 105 h = hashlib.sha1()
106 h.update(''.join(repo.heads())) 106 h.update(''.join(repo.heads()))
107 h.update(str(hash(frozenset(hideable)))) 107 h.update(str(hash(frozenset(hideable))))
108 return h.digest() 108 return h.digest()
109 109
110 def _writehiddencache(cachefile, cachehash, hidden): 110 def _writehiddencache(cachefile, cachehash, hidden):