comparison mercurial/localrepo.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 ee935a6e1ea2
children 37c7f9fb7040
comparison
equal deleted inserted replaced
29340:ae92c3eee88e 29341:0d83ad967bf8
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 from __future__ import absolute_import 8 from __future__ import absolute_import
9 9
10 import errno 10 import errno
11 import hashlib
11 import inspect 12 import inspect
12 import os 13 import os
13 import random 14 import random
14 import time 15 import time
15 import weakref 16 import weakref
1011 raise error.RepoError( 1012 raise error.RepoError(
1012 _("abandoned transaction found"), 1013 _("abandoned transaction found"),
1013 hint=_("run 'hg recover' to clean up transaction")) 1014 hint=_("run 'hg recover' to clean up transaction"))
1014 1015
1015 idbase = "%.40f#%f" % (random.random(), time.time()) 1016 idbase = "%.40f#%f" % (random.random(), time.time())
1016 txnid = 'TXN:' + util.sha1(idbase).hexdigest() 1017 txnid = 'TXN:' + hashlib.sha1(idbase).hexdigest()
1017 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid) 1018 self.hook('pretxnopen', throw=True, txnname=desc, txnid=txnid)
1018 1019
1019 self._writejournal(desc) 1020 self._writejournal(desc)
1020 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] 1021 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
1021 if report: 1022 if report: