changeset 50105:2323b74f927b

dirstate: invalidate on all exceptions Previously, we would miss SystemExit, KeyboardInterrupt etc. This "fix" on the bug tested in "test-largefiles-update.t" by preventing the precisely tested situation to happens at all. However this reveal a similar bug with a different timing. I have not been able to deal with that pre-existing bug so far. So I updated the test to point that out.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 21 Feb 2023 00:10:20 +0100
parents 7989646f1d5a
children cdbd5f990596
files mercurial/dirstate.py tests/test-largefiles-update.t
diffstat 2 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Feb 21 01:09:11 2023 +0100
+++ b/mercurial/dirstate.py	Tue Feb 21 00:10:20 2023 +0100
@@ -191,7 +191,7 @@
         self._changing_level += 1
         try:
             yield
-        except Exception:
+        except:  # re-raises
             self.invalidate()
             raise
         finally:
--- a/tests/test-largefiles-update.t	Tue Feb 21 01:09:11 2023 +0100
+++ b/tests/test-largefiles-update.t	Tue Feb 21 00:10:20 2023 +0100
@@ -771,9 +771,18 @@
   $ hg log -qr 'file("set:exec()")'
   9:be1b433a65b1
 
-Test a fatal error interrupting an update. Verify that status report dirty
-files correctly after an interrupted update. Also verify that checking all
-hashes reveals it isn't clean.
+Test a fatal error interrupting an update
+-----------------------------------------
+
+In a previous version this test was tasked to:
+| verify that status report dirty files correctly after an interrupted
+| update. Also verify that checking all hashes reveals it isn't clean.
+
+In the mean time improvement to the update logic means it is much harder to get the dirstate file written too early. So the original intend seems "fine".
+
+However, it shows another error where the standin file for large1 seems to be
+silently updated, confusing the general logic. This seems to have been broken
+before our updates and the test is marked as such.
 
 Start with clean dirstates:
   $ hg up --quiet --clean --rev "8^"
@@ -794,19 +803,24 @@
   [254]
 Check large1 content and status ... and that update will undo modifications:
   $ hg id
-  f1bf30eb88cc
+  d65e59e952a9+ (known-bad-output !)
+  d65e59e952a9 (missing-correct-output !)
   $ cat large1
   large1 in #3
   $ hg st
-  M large1
-  ! largeX
   $ hg up -Cr 8
   getting changed largefiles
-  2 largefiles updated, 0 removed
+  1 largefiles updated, 0 removed (known-bad-output !)
+  2 largefiles updated, 0 removed (missing-correct-output !)
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cat large1
-  manually modified before 'hg transplant --continue'
+  large1 in #3 (known-bad-output !)
+  manually modified before 'hg transplant --continue' (missing-correct-output !)
   $ hg st
+  M large1 (known-bad-output !)
+
+  $ hg revert --all --no-backup
+  reverting .hglf/large1 (known-bad-output !)
 Force largefiles rehashing and check that all changes have been caught by
 status and update:
   $ rm .hg/largefiles/dirstate