Mercurial > hg
diff rust/hg-core/src/dirstate/entry.rs @ 48086:80783e553bd5
dirstate-item: introduce a `maybe_clean` property
It is useful for some extension that seek to invalidate some state.
Differential Revision: https://phab.mercurial-scm.org/D11523
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 29 Sep 2021 14:41:19 +0200 |
parents | d3eb5f50052c |
children | 79bc60ca5946 |
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/entry.rs Wed Sep 29 02:37:24 2021 +0200 +++ b/rust/hg-core/src/dirstate/entry.rs Wed Sep 29 14:41:19 2021 +0200 @@ -191,6 +191,20 @@ self.flags.contains(Flags::WDIR_TRACKED | Flags::CLEAN_P2) } + pub fn maybe_clean(&self) -> bool { + if !self.flags.contains(Flags::WDIR_TRACKED) { + false + } else if self.added() { + false + } else if self.flags.contains(Flags::MERGED) { + false + } else if self.flags.contains(Flags::CLEAN_P2) { + false + } else { + true + } + } + pub fn state(&self) -> EntryState { if self.removed() { EntryState::Removed