Read about our upcoming Code of Conduct on this issue

Commit 29aea09c authored by Pierre-Yves David's avatar Pierre-Yves David 🐙
Browse files

dirstate-item: make sure we load `mtime-second-ambiguous` from disk

Now that we support the associated logic, we can safely load it from it. It is
no longer necessary to ignore the stored mtime when the flag is encountered.

Differential Revision: https://phab.mercurial-scm.org/D11846
parent 995aaacb12d7
......@@ -450,14 +450,6 @@ static PyObject *dirstate_item_from_v2_meth(PyTypeObject *subtype,
dirstate_flag_has_meaningful_data |
dirstate_flag_has_mtime);
}
if (t->flags & dirstate_flag_mtime_second_ambiguous) {
/* The current code is not able to do the more subtle comparison
* that the MTIME_SECOND_AMBIGUOUS requires. So we ignore the
* mtime */
t->flags &= ~(dirstate_flag_mtime_second_ambiguous |
dirstate_flag_has_meaningful_data |
dirstate_flag_has_mtime);
}
t->mode = 0;
if (t->flags & dirstate_flag_has_meaningful_data) {
if (t->flags & dirstate_flag_mode_exec_perm) {
......
......@@ -149,10 +149,6 @@ class DirstateItem(object):
"""Build a new DirstateItem object from V2 data"""
has_mode_size = bool(flags & DIRSTATE_V2_HAS_MODE_AND_SIZE)
has_meaningful_mtime = bool(flags & DIRSTATE_V2_HAS_MTIME)
if flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS:
# The current code is not able to do the more subtle comparison that the
# MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
has_meaningful_mtime = False
mode = None
if flags & +DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED:
......@@ -179,13 +175,15 @@ class DirstateItem(object):
mode |= stat.S_IFLNK
else:
mode |= stat.S_IFREG
second_ambiguous = flags & DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS
return cls(
wc_tracked=bool(flags & DIRSTATE_V2_WDIR_TRACKED),
p1_tracked=bool(flags & DIRSTATE_V2_P1_TRACKED),
p2_info=bool(flags & DIRSTATE_V2_P2_INFO),
has_meaningful_data=has_mode_size,
has_meaningful_mtime=has_meaningful_mtime,
parentfiledata=(mode, size, (mtime_s, mtime_ns, False)),
parentfiledata=(mode, size, (mtime_s, mtime_ns, second_ambiguous)),
fallback_exec=fallback_exec,
fallback_symlink=fallback_symlink,
)
......
......@@ -371,11 +371,12 @@ impl Node {
let mtime = if self.flags().contains(Flags::HAS_MTIME)
&& !self.flags().contains(Flags::DIRECTORY)
&& !self.flags().contains(Flags::EXPECTED_STATE_IS_MODIFIED)
// The current code is not able to do the more subtle comparison that the
// MTIME_SECOND_AMBIGUOUS requires. So we ignore the mtime
&& !self.flags().contains(Flags::MTIME_SECOND_AMBIGUOUS)
{
Some(self.mtime.try_into()?)
let mut m: TruncatedTimestamp = self.mtime.try_into()?;
if self.flags().contains(Flags::MTIME_SECOND_AMBIGUOUS) {
m.second_ambiguous = true;
}
Some(m)
} else {
None
};
......
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