Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit 3c3656e9 authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

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
parent af303ae33cd7
......@@ -269,7 +269,8 @@ static inline int dirstate_item_c_v1_mtime(dirstateItemObject *self)
} 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;
......
......@@ -551,6 +551,8 @@ class DirstateItem(object):
return AMBIGUOUS_TIME
elif not self._p1_tracked:
return AMBIGUOUS_TIME
elif self._mtime_second_ambiguous:
return AMBIGUOUS_TIME
else:
return self._mtime_s
......
......@@ -454,7 +454,11 @@ impl DirstateEntry {
} 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
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment