changeset 47540:1a6302427eb9

dirstate-item: use need_delay when packing dirstate Differential Revision: https://phab.mercurial-scm.org/D10984
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 05 Jul 2021 03:57:11 +0200
parents 84391ddf4c78
children a9f38b144096
files mercurial/pure/parsers.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/pure/parsers.py	Sun Jul 04 22:27:29 2021 +0200
+++ b/mercurial/pure/parsers.py	Mon Jul 05 03:57:11 2021 +0200
@@ -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):
     """represent 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: