Patchwork D10984: dirstate-item: use need_delay when packing dirstate

login
register
mail settings
Submitter phabricator
Date July 5, 2021, 9:34 a.m.
Message ID <differential-rev-PHID-DREV-3ucraoyay3yaurwbki2g-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49297/
State Superseded
Headers show

Comments

phabricator - July 5, 2021, 9:34 a.m.
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




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

Patch

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: