equal
deleted
inserted
replaced
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()] |