dirstate: drop some very fishy looking piece of code
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 06 Feb 2023 01:22:01 +0100
changeset 50003 f4eef08575ce
parent 50002 e358f6e0e50e
child 50004 3c34a224c232
dirstate: drop some very fishy looking piece of code This piece of code is marking the **real** dirstate file as a temporary transaction file. This means it get deleted on transaction rollback. This this quite wrong, especially as the comment points out some `dirstate.pending` motivation and the `.pending` file should already be fully managed by the transaction. The only ready I can think of this behavior not having awful results right now is because other transaction logic restore backed up content above the one that got wrongfully deleted. Let us stop doing this anyway, All tests seems happy.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Tue Feb 14 23:05:18 2023 +0100
+++ b/mercurial/dirstate.py	Mon Feb 06 01:22:01 2023 +0100
@@ -1527,11 +1527,6 @@
                 post_finalize=True,
             )
 
-            # ensure that pending file written above is unlinked at
-            # failure, even if tr.writepending isn't invoked until the
-            # end of this transaction
-            tr.registertmp(filename, location=b'plain')
-
         self._opener.tryunlink(backupname)
         if self._opener.exists(filename):
             # hardlink backup is okay because _writedirstate is always called