# HG changeset patch # User Raphaël Gomès # Date 1648486435 -7200 # Node ID a85c123c625affc7551f9ba4c67762dfbd02e23d # Parent be9bf75a837c233a5c7357a88111704027f1fd9b rust-dirstate: don't return a state for untracked entries This `state` API is a remnant of the former API and is slated for removal at some point. Any caller of this function will expect an entry that is tracked in the larger sense. Differential Revision: https://phab.mercurial-scm.org/D12448 diff -r be9bf75a837c -r a85c123c625a rust/hg-core/src/dirstate_tree/dirstate_map.rs --- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs Tue Mar 22 16:33:18 2022 +0100 +++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs Mon Mar 28 18:53:55 2022 +0200 @@ -343,7 +343,13 @@ pub(super) fn state( &self, ) -> Result, DirstateV2ParseError> { - Ok(self.entry()?.map(|e| e.state())) + Ok(self.entry()?.and_then(|e| { + if e.any_tracked() { + Some(e.state()) + } else { + None + } + })) } pub(super) fn cached_directory_mtime(