We want to preserve the second-ambiguity alongside the ambiguous mtime. So we
use the decimated flag for that.
note: the C code was already doing so. No change was needed to it.
Alphare |
hg-reviewers |
We want to preserve the second-ambiguity alongside the ambiguous mtime. So we
use the decimated flag for that.
note: the C code was already doing so. No change was needed to it.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/pure/parsers.py (2 lines) | |||
M | rust/hg-core/src/dirstate/entry.rs (2 lines) | |||
M | rust/hg-core/src/dirstate_tree/on_disk.rs (3 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
71b22fcfc3c5 | 8de960ee5631 | Pierre-Yves David | Nov 23 2021, 11:00 PM |
if self._mode is not None and self._size is not None: | if self._mode is not None and self._size is not None: | ||||
flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE | flags |= DIRSTATE_V2_HAS_MODE_AND_SIZE | ||||
if self.mode & stat.S_IXUSR: | if self.mode & stat.S_IXUSR: | ||||
flags |= DIRSTATE_V2_MODE_EXEC_PERM | flags |= DIRSTATE_V2_MODE_EXEC_PERM | ||||
if stat.S_ISLNK(self.mode): | if stat.S_ISLNK(self.mode): | ||||
flags |= DIRSTATE_V2_MODE_IS_SYMLINK | flags |= DIRSTATE_V2_MODE_IS_SYMLINK | ||||
if self._mtime_s is not None: | if self._mtime_s is not None: | ||||
flags |= DIRSTATE_V2_HAS_MTIME | flags |= DIRSTATE_V2_HAS_MTIME | ||||
if self._mtime_second_ambiguous: | |||||
flags |= DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS | |||||
if self._fallback_exec is not None: | if self._fallback_exec is not None: | ||||
flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC | flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC | ||||
if self._fallback_exec: | if self._fallback_exec: | ||||
flags |= DIRSTATE_V2_FALLBACK_EXEC | flags |= DIRSTATE_V2_FALLBACK_EXEC | ||||
if self._fallback_symlink is not None: | if self._fallback_symlink is not None: | ||||
flags |= DIRSTATE_V2_HAS_FALLBACK_SYMLINK | flags |= DIRSTATE_V2_HAS_FALLBACK_SYMLINK |
} | } | ||||
/// A Unix timestamp with nanoseconds precision | /// A Unix timestamp with nanoseconds precision | ||||
#[derive(Debug, Copy, Clone)] | #[derive(Debug, Copy, Clone)] | ||||
pub struct TruncatedTimestamp { | pub struct TruncatedTimestamp { | ||||
truncated_seconds: u32, | truncated_seconds: u32, | ||||
/// Always in the `0 .. 1_000_000_000` range. | /// Always in the `0 .. 1_000_000_000` range. | ||||
nanoseconds: u32, | nanoseconds: u32, | ||||
second_ambiguous: bool, | pub second_ambiguous: bool, | ||||
} | } | ||||
impl TruncatedTimestamp { | impl TruncatedTimestamp { | ||||
/// Constructs from a timestamp potentially outside of the supported range, | /// Constructs from a timestamp potentially outside of the supported range, | ||||
/// and truncate the seconds components to its lower 31 bits. | /// and truncate the seconds components to its lower 31 bits. | ||||
/// | /// | ||||
/// Panics if the nanoseconds components is not in the expected range. | /// Panics if the nanoseconds components is not in the expected range. | ||||
pub fn new_truncate( | pub fn new_truncate( |
flags.set(Flags::MODE_IS_SYMLINK, is_symlink); | flags.set(Flags::MODE_IS_SYMLINK, is_symlink); | ||||
flags.insert(Flags::HAS_MODE_AND_SIZE); | flags.insert(Flags::HAS_MODE_AND_SIZE); | ||||
s.into() | s.into() | ||||
} else { | } else { | ||||
0.into() | 0.into() | ||||
}; | }; | ||||
let mtime = if let Some(m) = mtime_opt { | let mtime = if let Some(m) = mtime_opt { | ||||
flags.insert(Flags::HAS_MTIME); | flags.insert(Flags::HAS_MTIME); | ||||
if m.second_ambiguous { | |||||
flags.insert(Flags::MTIME_SECOND_AMBIGUOUS); | |||||
}; | |||||
m.into() | m.into() | ||||
} else { | } else { | ||||
PackedTruncatedTimestamp::null() | PackedTruncatedTimestamp::null() | ||||
}; | }; | ||||
if let Some(f_exec) = fallback_exec { | if let Some(f_exec) = fallback_exec { | ||||
flags.insert(Flags::HAS_FALLBACK_EXEC); | flags.insert(Flags::HAS_FALLBACK_EXEC); | ||||
if f_exec { | if f_exec { | ||||
flags.insert(Flags::FALLBACK_EXEC); | flags.insert(Flags::FALLBACK_EXEC); |