Mercurial > public > mercurial-scm > hg
diff 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 |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Tue Oct 19 22:04:14 2021 +0200 +++ b/mercurial/pure/parsers.py Thu Oct 14 13:54:39 2021 +0200 @@ -302,7 +302,9 @@ return False self_ns = self._mtime_ns other_sec, other_ns = other_mtime - return self_sec == other_sec and self_ns == other_ns + return self_sec == other_sec and ( + self_ns == other_ns or self_ns == 0 or other_ns == 0 + ) @property def state(self):