undo-files: drop the old undo rename logic
It is no longer necessary
I am not changing the transaction.__init__ signature since we are on stable
right now.
--- a/mercurial/localrepo.py Mon Mar 06 19:22:34 2023 +0100
+++ b/mercurial/localrepo.py Mon Mar 06 19:39:35 2023 +0100
@@ -2418,7 +2418,6 @@
self.hook(b'pretxnopen', throw=True, txnname=desc, txnid=txnid)
self._writejournal(desc)
- renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]
if report:
rp = report
else:
@@ -2576,7 +2575,7 @@
vfsmap,
b"journal",
b"undo",
- aftertrans(renames),
+ lambda: None,
self.store.createmode,
validator=validate,
releasefn=releasefn,
@@ -3549,24 +3548,6 @@
self._sidedata_computers[kind][category] = (keys, computer, flags)
-# used to avoid circular references so destructors work
-def aftertrans(files):
- renamefiles = [tuple(t) for t in files]
-
- def a():
- for vfs, src, dest in renamefiles:
- # if src and dest refer to a same file, vfs.rename is a no-op,
- # leaving both src and dest on disk. delete dest to make sure
- # the rename couldn't be such a no-op.
- vfs.tryunlink(dest)
- try:
- vfs.rename(src, dest)
- except FileNotFoundError: # journal file does not yet exist
- pass
-
- return a
-
-
def undoname(fn: bytes) -> bytes:
base, name = os.path.split(fn)
assert name.startswith(b'journal')