Mercurial > public > mercurial-scm > hg-stable
diff rust/hg-core/src/dirstate.rs @ 47122:e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Unlike the other DirstateMap implementation, these sets are not materialized
separately in memory. Instead we traverse the main tree.
Differential Revision: https://phab.mercurial-scm.org/D10492
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Fri, 09 Apr 2021 13:13:19 +0200 |
parents | 52906934b775 |
children | be579775c2d9 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate.rs Fri Apr 09 12:55:35 2021 +0200 +++ b/rust/hg-core/src/dirstate.rs Fri Apr 09 13:13:19 2021 +0200 @@ -34,6 +34,16 @@ pub size: i32, } +impl DirstateEntry { + pub fn is_non_normal(&self) -> bool { + self.state != EntryState::Normal || self.mtime == MTIME_UNSET + } + + pub fn is_from_other_parent(&self) -> bool { + self.state == EntryState::Normal && self.size == SIZE_FROM_OTHER_PARENT + } +} + #[derive(BytesCast)] #[repr(C)] struct RawEntry { @@ -44,6 +54,8 @@ length: unaligned::I32Be, } +const MTIME_UNSET: i32 = -1; + /// A `DirstateEntry` with a size of `-2` means that it was merged from the /// other parent. This allows revert to pick the right status back during a /// merge.