##// END OF EJS Templates
undo-files: drop the old undo rename logic...
marmoute -
r51193:47310375 stable
parent child Browse files
Show More
@@ -2418,7 +2418,6 b' class localrepository:'
2418 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid)
2418 self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid)
2419
2419
2420 self._writejournal(desc)
2420 self._writejournal(desc)
2421 renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
2422 if report:
2421 if report:
2423 rp = report
2422 rp = report
2424 else:
2423 else:
@@ -2576,7 +2575,7 b' class localrepository:'
2576 vfsmap,
2575 vfsmap,
2577 b"journal",
2576 b"journal",
2578 b"undo",
2577 b"undo",
2579 aftertrans(renames),
2578 lambda: None,
2580 self.store.createmode,
2579 self.store.createmode,
2581 validator=validate,
2580 validator=validate,
2582 releasefn=releasefn,
2581 releasefn=releasefn,
@@ -3549,24 +3548,6 b' class localrepository:'
3549 self._sidedata_computers[kind][category] = (keys, computer, flags)
3548 self._sidedata_computers[kind][category] = (keys, computer, flags)
3550
3549
3551
3550
3552 # used to avoid circular references so destructors work
3553 def aftertrans(files):
3554 renamefiles = [tuple(t) for t in files]
3555
3556 def a():
3557 for vfs, src, dest in renamefiles:
3558 # if src and dest refer to a same file, vfs.rename is a no-op,
3559 # leaving both src and dest on disk. delete dest to make sure
3560 # the rename couldn't be such a no-op.
3561 vfs.tryunlink(dest)
3562 try:
3563 vfs.rename(src, dest)
3564 except FileNotFoundError: # journal file does not yet exist
3565 pass
3566
3567 return a
3568
3569
3570 def undoname(fn: bytes) -> bytes:
3551 def undoname(fn: bytes) -> bytes:
3571 base, name = os.path.split(fn)
3552 base, name = os.path.split(fn)
3572 assert name.startswith(b'journal')
3553 assert name.startswith(b'journal')
General Comments 0
You need to be logged in to leave comments. Login now