changeset 50111:c5ef535e274e

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Feb 2023 23:28:20 +0100
parents e2b89b6d4cdd
children 1f369ca9e34c
files mercurial/context.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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: