status: fix post status writing
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 15 Feb 2023 23:28:20 +0100
changeset 50111 c5ef535e274e
parent 50110 e2b89b6d4cdd
child 50112 1f369ca9e34c
status: fix post status writing With dirstate-v2, the status process itself might update internal states. So we make sure this get written on disk
mercurial/context.py
--- a/mercurial/context.py	Thu Dec 15 02:54:06 2022 +0100
+++ b/mercurial/context.py	Wed Feb 15 23:28:20 2023 +0100
@@ -1875,12 +1875,16 @@
                                 normal = dirstate.set_clean
                             for f, pdf in fixup:
                                 normal(f, pdf)
-                            # write changes out explicitly, because nesting
-                            # wlock at runtime may prevent 'wlock.release()'
-                            # after this block from doing so for subsequent
-                            # changing files
-                            tr = self._repo.currenttransaction()
-                            self._repo.dirstate.write(tr)
+                        # write changes out explicitly, because nesting
+                        # wlock at runtime may prevent 'wlock.release()'
+                        # after this block from doing so for subsequent
+                        # changing files
+                        #
+                        # (This is outside of the (if fixup) block because the
+                        # status operation itself might have updated some cache
+                        # information before.)
+                        tr = self._repo.currenttransaction()
+                        self._repo.dirstate.write(tr)
 
                         if poststatus:
                             for ps in poststatus: