[Request] [+ ] D12448: rust-dirstate: don't return a state for untracked entries

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Wed Apr 6 14:10:59 UTC 2022


Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12448

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -343,7 +343,13 @@
     pub(super) fn state(
         &self,
     ) -> Result<Option<EntryState>, 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(



To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220406/8bcdc27a/attachment-0001.html>


More information about the Mercurial-patches mailing list