[Updated] [+- ] D11791: dirstate: stop gathering parentfiledata in update_file

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Nov 30 23:56:28 UTC 2021


marmoute updated this revision to Diff 31228.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11791?vs=31113&id=31228

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11791/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D11791

AFFECTED FILES
  mercurial/dirstate.py
  tests/test-backout.t
  tests/test-dirstate-race2.t
  tests/test-largefiles-update.t
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -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
 
diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t
--- a/tests/test-largefiles-update.t
+++ b/tests/test-largefiles-update.t
@@ -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
 
diff --git a/tests/test-dirstate-race2.t b/tests/test-dirstate-race2.t
--- a/tests/test-dirstate-race2.t
+++ b/tests/test-dirstate-race2.t
@@ -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.
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -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
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -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,



To: marmoute, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211130/7822d591/attachment-0002.html>


More information about the Mercurial-patches mailing list