Mercurial > public > mercurial-scm > hg-stable
diff rust/rhg/src/commands/status.rs @ 52754:7405f8a67611
rhg: fix status --rev --rev sparse bug
This fixes the bug discovered in f0c439952ecb6579ee89abee84fae5587f5dda66.
The bug was introduced in 136e74c2bf8f917cf963dc1b594b6a90f8e5f627.
author | Mitchell Kember <mkember@janestreet.com> |
---|---|
date | Tue, 04 Feb 2025 14:02:20 -0500 |
parents | 65839176cea9 |
children |
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs Tue Feb 04 13:39:28 2025 -0500 +++ b/rust/rhg/src/commands/status.rs Tue Feb 04 14:02:20 2025 -0500 @@ -462,14 +462,18 @@ let (narrow_matcher, narrow_warnings) = narrow::matcher(repo)?; let (sparse_matcher, sparse_warnings) = sparse::matcher(repo)?; - let matcher = match (repo.has_narrow(), repo.has_sparse()) { - (true, true) => { - Box::new(IntersectionMatcher::new(narrow_matcher, sparse_matcher)) - } - (true, false) => narrow_matcher, - (false, true) => sparse_matcher, - (false, false) => Box::new(AlwaysMatcher), - }; + // Sparse is only applicable for the working copy, not history. + let sparse_is_applicable = revpair.is_none() && change.is_none(); + let matcher = + match (repo.has_narrow(), repo.has_sparse() && sparse_is_applicable) { + (true, true) => Box::new(IntersectionMatcher::new( + narrow_matcher, + sparse_matcher, + )), + (true, false) => narrow_matcher, + (false, true) => sparse_matcher, + (false, false) => Box::new(AlwaysMatcher), + }; let matcher = match args.get_many::<std::ffi::OsString>("file") { None => matcher, Some(files) => {