# HG changeset patch # User Raphaël Gomès # Date 1727716519 -7200 # Node ID 7c105b953ca439ea3c0d1ab1b0074089223cff5c # Parent b8b3984deae36c78ff618c321d21725a98ab49ab rust-files: separate the listing of files from a revset and a revision We won't need to parse a revset all the time, and an upcoming patch will make use of this new util. diff -r b8b3984deae3 -r 7c105b953ca4 rust/hg-core/src/operations/list_tracked_files.rs --- a/rust/hg-core/src/operations/list_tracked_files.rs Mon Sep 30 19:12:42 2024 +0200 +++ b/rust/hg-core/src/operations/list_tracked_files.rs Mon Sep 30 19:15:19 2024 +0200 @@ -14,10 +14,10 @@ use crate::revlog::RevlogError; use crate::utils::filter_map_results; use crate::utils::hg_path::HgPath; -use crate::Node; +use crate::{Node, UncheckedRevision}; -/// List files under Mercurial control at a given revision. -pub fn list_rev_tracked_files( +/// List files under Mercurial control at a given revset. +pub fn list_revset_tracked_files( repo: &Repo, revset: &str, narrow_matcher: Box, @@ -29,6 +29,18 @@ }) } +/// List files under Mercurial control at a given revision. +pub fn list_rev_tracked_files( + repo: &Repo, + rev: UncheckedRevision, + narrow_matcher: Box, +) -> Result { + Ok(FilesForRev { + manifest: repo.manifest_for_rev(rev)?, + narrow_matcher, + }) +} + pub struct FilesForRev { manifest: Manifest, narrow_matcher: Box, diff -r b8b3984deae3 -r 7c105b953ca4 rust/hg-core/src/operations/mod.rs --- a/rust/hg-core/src/operations/mod.rs Mon Sep 30 19:12:42 2024 +0200 +++ b/rust/hg-core/src/operations/mod.rs Mon Sep 30 19:15:19 2024 +0200 @@ -8,5 +8,8 @@ mod status_rev_rev; pub use cat::{cat, CatOutput}; pub use debugdata::debug_data; -pub use list_tracked_files::{list_rev_tracked_files, FilesForRev}; +pub use list_tracked_files::{ + list_rev_tracked_files, list_revset_tracked_files, ExpandedManifestEntry, + FilesForRev, +}; pub use status_rev_rev::{status_rev_rev_no_copies, DiffStatus, StatusRevRev}; diff -r b8b3984deae3 -r 7c105b953ca4 rust/rhg/src/commands/files.rs --- a/rust/rhg/src/commands/files.rs Mon Sep 30 19:12:42 2024 +0200 +++ b/rust/rhg/src/commands/files.rs Mon Sep 30 19:15:19 2024 +0200 @@ -7,7 +7,7 @@ use hg::filepatterns::parse_pattern_args; use hg::matchers::IntersectionMatcher; use hg::narrow; -use hg::operations::list_rev_tracked_files; +use hg::operations::list_revset_tracked_files; use hg::repo::Repo; use hg::utils::files::get_bytes_from_os_str; use hg::utils::filter_map_results; @@ -88,7 +88,7 @@ }; if let Some(rev) = rev { - let files = list_rev_tracked_files(repo, rev, matcher) + let files = list_revset_tracked_files(repo, rev, matcher) .map_err(|e| (e, rev.as_ref()))?; display_files( invocation.ui,