Mercurial > hg
diff mercurial/pure/parsers.py @ 48399:af303ae33cd7
dirstate-item: implement the comparison logic for mtime-second-ambiguous
If the flag is set we now process it properly.
We "just" need to actually set it and persist it.
Differential Revision: https://phab.mercurial-scm.org/D11843
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 24 Nov 2021 04:51:05 +0100 |
parents | 111098af6356 |
children | 0b3f3a3ca50a |
line wrap: on
line diff
--- a/mercurial/pure/parsers.py Wed Nov 24 04:40:00 2021 +0100 +++ b/mercurial/pure/parsers.py Wed Nov 24 04:51:05 2021 +0100 @@ -310,9 +310,21 @@ return False self_ns = self._mtime_ns other_sec, other_ns, second_ambiguous = other_mtime - return self_sec == other_sec and ( - self_ns == other_ns or self_ns == 0 or other_ns == 0 - ) + if self_sec != other_sec: + # seconds are different theses mtime are definitly not equal + return False + elif other_ns == 0 or self_ns == 0: + # at least one side as no nano-seconds information + + if self._mtime_second_ambiguous: + # We cannot trust the mtime in this case + return False + else: + # the "seconds" value was reliable on its own. We are good to go. + return True + else: + # We have nano second information, let us use them ! + return self_ns == other_ns @property def state(self):