mercurial/dirstate.py
changeset 48055 84e7a86e3a63
parent 48044 d5528ac9b4f2
child 48057 62188e4de549
--- a/mercurial/dirstate.py	Tue Sep 28 09:32:24 2021 -0700
+++ b/mercurial/dirstate.py	Wed Sep 22 14:54:42 2021 +0200
@@ -836,19 +836,17 @@
             # See also the wiki page below for detail:
             # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
 
-            # emulate dropping timestamp in 'parsers.pack_dirstate'
+            # record when mtime start to be ambiguous
             now = _getfsnow(self._opener)
-            self._map.clearambiguoustimes(self._updatedfiles, now)
 
             # emulate that all 'dirstate.normal' results are written out
-            self._lastnormaltime = 0
             self._updatedfiles.clear()
 
             # delay writing in-memory changes out
             tr.addfilegenerator(
                 b'dirstate',
                 (self._filename,),
-                lambda f: self._writedirstate(tr, f),
+                lambda f: self._writedirstate(tr, f, now=now),
                 location=b'plain',
             )
             return
@@ -867,7 +865,7 @@
         """
         self._plchangecallbacks[category] = callback
 
-    def _writedirstate(self, tr, st):
+    def _writedirstate(self, tr, st, now=None):
         # notify callbacks about parents change
         if self._origpl is not None and self._origpl != self._pl:
             for c, callback in sorted(
@@ -875,9 +873,11 @@
             ):
                 callback(self, self._origpl, self._pl)
             self._origpl = None
-        # use the modification time of the newly created temporary file as the
-        # filesystem's notion of 'now'
-        now = util.fstat(st)[stat.ST_MTIME] & _rangemask
+
+        if now is None:
+            # use the modification time of the newly created temporary file as the
+            # filesystem's notion of 'now'
+            now = util.fstat(st)[stat.ST_MTIME] & _rangemask
 
         # enough 'delaywrite' prevents 'pack_dirstate' from dropping
         # timestamp of each entries in dirstate, because of 'now > mtime'