Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 44060:a61287a95dc3
core: migrate uses of hashlib.sha1 to hashutil.sha1
Differential Revision: https://phab.mercurial-scm.org/D7849
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 13 Jan 2020 17:15:14 -0500 |
parents | b74270da5eee |
children | 2122ffa903ea |
comparison
equal
deleted
inserted
replaced
44059:7126d8b8e0e6 | 44060:a61287a95dc3 |
---|---|
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 | |
12 import os | 11 import os |
13 import random | 12 import random |
14 import sys | 13 import sys |
15 import time | 14 import time |
16 import weakref | 15 import weakref |
72 repository, | 71 repository, |
73 util as interfaceutil, | 72 util as interfaceutil, |
74 ) | 73 ) |
75 | 74 |
76 from .utils import ( | 75 from .utils import ( |
76 hashutil, | |
77 procutil, | 77 procutil, |
78 stringutil, | 78 stringutil, |
79 ) | 79 ) |
80 | 80 |
81 from .revlogutils import constants as revlogconst | 81 from .revlogutils import constants as revlogconst |
2005 _(b"abandoned transaction found"), | 2005 _(b"abandoned transaction found"), |
2006 hint=_(b"run 'hg recover' to clean up transaction"), | 2006 hint=_(b"run 'hg recover' to clean up transaction"), |
2007 ) | 2007 ) |
2008 | 2008 |
2009 idbase = b"%.40f#%f" % (random.random(), time.time()) | 2009 idbase = b"%.40f#%f" % (random.random(), time.time()) |
2010 ha = hex(hashlib.sha1(idbase).digest()) | 2010 ha = hex(hashutil.sha1(idbase).digest()) |
2011 txnid = b'TXN:' + ha | 2011 txnid = b'TXN:' + ha |
2012 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid) | 2012 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid) |
2013 | 2013 |
2014 self._writejournal(desc) | 2014 self._writejournal(desc) |
2015 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] | 2015 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()] |