Mercurial > hg
changeset 48400:0b3f3a3ca50a
dirstate-item: ignore mtime to write v1 when `mtime-second-ambiguous` is set
We cannot preserve that information in the v1 format so that mtime is ambiguous.
Differential Revision: https://phab.mercurial-scm.org/D11844
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 24 Nov 2021 04:59:48 +0100 |
parents | af303ae33cd7 |
children | 995aaacb12d7 |
files | mercurial/cext/parsers.c mercurial/pure/parsers.py rust/hg-core/src/dirstate/entry.rs |
diffstat | 3 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Wed Nov 24 04:51:05 2021 +0100 +++ b/mercurial/cext/parsers.c Wed Nov 24 04:59:48 2021 +0100 @@ -269,7 +269,8 @@ } else if (!(self->flags & dirstate_flag_has_mtime) || !(self->flags & dirstate_flag_p1_tracked) || !(self->flags & dirstate_flag_wc_tracked) || - (self->flags & dirstate_flag_p2_info)) { + (self->flags & dirstate_flag_p2_info) || + (self->flags & dirstate_flag_mtime_second_ambiguous)) { return ambiguous_time; } else { return self->mtime_s;
--- a/mercurial/pure/parsers.py Wed Nov 24 04:51:05 2021 +0100 +++ b/mercurial/pure/parsers.py Wed Nov 24 04:59:48 2021 +0100 @@ -551,6 +551,8 @@ return AMBIGUOUS_TIME elif not self._p1_tracked: return AMBIGUOUS_TIME + elif self._mtime_second_ambiguous: + return AMBIGUOUS_TIME else: return self._mtime_s
--- a/rust/hg-core/src/dirstate/entry.rs Wed Nov 24 04:51:05 2021 +0100 +++ b/rust/hg-core/src/dirstate/entry.rs Wed Nov 24 04:59:48 2021 +0100 @@ -454,7 +454,11 @@ } else if !self.flags.contains(Flags::P1_TRACKED) { MTIME_UNSET } else if let Some(mtime) = self.mtime { - i32::try_from(mtime.truncated_seconds()).unwrap() + if mtime.second_ambiguous { + MTIME_UNSET + } else { + i32::try_from(mtime.truncated_seconds()).unwrap() + } } else { MTIME_UNSET }