D10984: dirstate-item: use need_delay when packing dirstate

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 5 09:34:45 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -39,6 +39,9 @@
 # a special value used internally for `size` if the file is modified/merged/added
 NONNORMAL = -1
 
+# a special value used internally for `time` if the time is ambigeous
+AMBIGUOUS_TIME = -1
+
 
 class DirstateItem(object):
     """represente a dirstate entry
@@ -540,7 +543,7 @@
     write = cs.write
     write(b"".join(pl))
     for f, e in pycompat.iteritems(dmap):
-        if e[0] == b'n' and e[3] == now:
+        if e.need_delay(now):
             # The file was last modified "simultaneously" with the current
             # write to dirstate (i.e. within the same second for file-
             # systems with a granularity of 1 sec). This commonly happens
@@ -550,7 +553,7 @@
             # dirstate, forcing future 'status' calls to compare the
             # contents of the file if the size is the same. This prevents
             # mistakenly treating such files as clean.
-            e = DirstateItem(e[0], e[1], e[2], -1)
+            e = DirstateItem(e.state, e.mode, e.size, AMBIGUOUS_TIME)
             dmap[f] = e
 
         if f in copymap:



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list