changeset 48387:f838f5bca038

dirstate: stop gathering parentfiledata in update_file Gathering information here assume that they are valid cache information for a clean file. It is true most of the time, but not garanteed. Accurate data can still be explicitly provided. We drop the spontaneous and will let the next `hg status` call record actual information. Differential Revision: https://phab.mercurial-scm.org/D11791
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 17 Nov 2021 20:27:27 +0100
parents 6becd5773133
children f5dea753fe4e
files mercurial/dirstate.py tests/test-backout.t tests/test-dirstate-race2.t tests/test-largefiles-update.t tests/test-transplant.t
diffstat 5 files changed, 31 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Nov 17 20:26:33 2021 +0100
+++ b/mercurial/dirstate.py	Wed Nov 17 20:27:27 2021 +0100
@@ -573,13 +573,6 @@
 
         self._dirty = True
 
-        need_parent_file_data = (
-            not possibly_dirty and not p2_info and wc_tracked and p1_tracked
-        )
-
-        if need_parent_file_data and parentfiledata is None:
-            parentfiledata = self._get_filedata(filename)
-
         self._map.reset_state(
             filename,
             wc_tracked,
--- a/tests/test-backout.t	Wed Nov 17 20:26:33 2021 +0100
+++ b/tests/test-backout.t	Wed Nov 17 20:27:27 2021 +0100
@@ -173,8 +173,7 @@
   C c
   $ hg debugstate --no-dates
   n 644         12 set                 c (no-rhg !)
-  n 644         12 unset               c (?)
-  n 644         12 set                 c (?)
+  n   0         -1 unset               c (rhg known-bad-output !)
   $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r .
   removing c
   adding b
--- a/tests/test-dirstate-race2.t	Wed Nov 17 20:26:33 2021 +0100
+++ b/tests/test-dirstate-race2.t	Wed Nov 17 20:27:27 2021 +0100
@@ -9,6 +9,9 @@
   > EOF
 #endif
 
+TODO: fix rhg bugs that make this test fail when status is enabled
+  $ unset RHG_STATUS
+
 Checking the size/permissions/file-type of files stored in the
 dirstate after an update where the files are changed concurrently
 outside of hg's control.
--- a/tests/test-largefiles-update.t	Wed Nov 17 20:26:33 2021 +0100
+++ b/tests/test-largefiles-update.t	Wed Nov 17 20:27:27 2021 +0100
@@ -68,20 +68,39 @@
 A linear merge will update standins before performing the actual merge. It will
 do a lfdirstate status walk and find 'unset'/'unsure' files, hash them, and
 update the corresponding standins.
+
 Verify that it actually marks the clean files as clean in lfdirstate so
 we don't have to hash them again next time we update.
 
+# note:
+#    We do this less agressively now, to avoid race condition, however the
+#    cache
+#    is properly set after the next status
+#
+#    The "changed" output is marked as missing-correct-output/known-bad-output
+#    for clarify
+
   $ hg up
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   updated to "f74e50bd9e55: #2"
   1 other heads for branch "default"
   $ hg debugdirstate --large --nodate
+  n 644          7 set                 large1 (missing-correct-output !)
+  n 644         13 set                 large2 (missing-correct-output !)
+  n   0         -1 unset               large1 (known-bad-output !)
+  n   0         -1 unset               large2 (known-bad-output !)
+  $ sleep 1 # so that mtime are not ambiguous
+  $ hg status
+  $ hg debugdirstate --large --nodate
   n 644          7 set                 large1
   n 644         13 set                 large2
 
 Test that lfdirstate keeps track of last modification of largefiles and
 prevents unnecessary hashing of content - also after linear/noop update
 
+(XXX Since there is a possible race during update, we only do this after the next
+status call, this is slower, but more correct)
+
   $ sleep 1
   $ hg st
   $ hg debugdirstate --large --nodate
@@ -92,6 +111,13 @@
   updated to "f74e50bd9e55: #2"
   1 other heads for branch "default"
   $ hg debugdirstate --large --nodate
+  n 644          7 set                 large1 (missing-correct-output !)
+  n 644         13 set                 large2 (missing-correct-output !)
+  n   0         -1 unset               large1 (known-bad-output !)
+  n   0         -1 unset               large2 (known-bad-output !)
+  $ sleep 1 # so that mtime are not ambiguous
+  $ hg status
+  $ hg debugdirstate --large --nodate
   n 644          7 set                 large1
   n 644         13 set                 large2
 
--- a/tests/test-transplant.t	Wed Nov 17 20:26:33 2021 +0100
+++ b/tests/test-transplant.t	Wed Nov 17 20:27:27 2021 +0100
@@ -1063,7 +1063,7 @@
   $ cat r1
   Y1
   $ hg debugstate | grep ' r1$'
-  n 644          3 unset               r1
+  n   0         -1 unset               r1
   $ hg status -A r1
   M r1