Mercurial > public > mercurial-scm > hg
diff rust/hg-core/src/dirstate.rs @ 47113:be579775c2d9
dirstate-tree: Add the new `status()` algorithm
With the dirstate organized in a tree that mirrors the structure of the
filesystem tree, we can traverse both trees at the same time in order to
compare them. This is hopefully more efficient that building multiple
big hashmaps for all of the repository?s contents.
Differential Revision: https://phab.mercurial-scm.org/D10547
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 16 Apr 2021 12:12:41 +0200 |
parents | e3cebe96c0fc |
children | cd8ca38fccff |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate.rs Fri Apr 16 12:12:04 2021 +0200 +++ b/rust/hg-core/src/dirstate.rs Fri Apr 16 12:12:41 2021 +0200 @@ -42,6 +42,19 @@ pub fn is_from_other_parent(&self) -> bool { self.state == EntryState::Normal && self.size == SIZE_FROM_OTHER_PARENT } + + // TODO: other platforms + #[cfg(unix)] + pub fn mode_changed( + &self, + filesystem_metadata: &std::fs::Metadata, + ) -> bool { + use std::os::unix::fs::MetadataExt; + const EXEC_BIT_MASK: u32 = 0o100; + let dirstate_exec_bit = (self.mode as u32) & EXEC_BIT_MASK; + let fs_exec_bit = filesystem_metadata.mode() & EXEC_BIT_MASK; + dirstate_exec_bit != fs_exec_bit + } } #[derive(BytesCast)]