comparison mercurial/pure/parsers.py @ 48262:68bb472aee9c

dirstate: ignore sub-second component when either is zero in mtime When comparing mtimes for equality. Some APIs simply return zero when more precision is not available. When comparing values from different sources, if only one is truncated in that way, doing a simple comparison would cause many false negatives. Differential Revision: https://phab.mercurial-scm.org/D11701
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 14 Oct 2021 13:54:39 +0200
parents 9205d9be8b41
children bb240915f69f
comparison
equal deleted inserted replaced
48261:9205d9be8b41 48262:68bb472aee9c
300 self_sec = self._mtime_s 300 self_sec = self._mtime_s
301 if self_sec is None: 301 if self_sec is None:
302 return False 302 return False
303 self_ns = self._mtime_ns 303 self_ns = self._mtime_ns
304 other_sec, other_ns = other_mtime 304 other_sec, other_ns = other_mtime
305 return self_sec == other_sec and self_ns == other_ns 305 return self_sec == other_sec and (
306 self_ns == other_ns or self_ns == 0 or other_ns == 0
307 )
306 308
307 @property 309 @property
308 def state(self): 310 def state(self):
309 """ 311 """
310 States are: 312 States are: