##// END OF EJS Templates
rust: run a clippy pass with the latest stable version...
rust: run a clippy pass with the latest stable version Our current version of clippy is older than the latest stable. The newest version has new lints that are moslty good advice, so let's apply them ahead of time. This has the added benefit of reducing the noise for developpers like myself that use clippy as an IDE helper, as well as being more prepared for a future clippy upgrade.

File last commit:

r51870:1928b770 default
r52013:532e74ad default
Show More
list_tracked_files.rs
45 lines | 1.2 KiB | application/rls-services+xml | RustLexer
/ rust / hg-core / src / operations / list_tracked_files.rs
Antoine Cezar
hg-core: define a `ListTrackedFiles` `Operation`...
r45918 // list_tracked_files.rs
//
// Copyright 2020 Antoine Cezar <antoine.cezar@octobus.net>
//
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
Simon Sapin
rust: use HgError in RevlogError and Vfs...
r47172 use crate::errors::HgError;
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 use crate::matchers::Matcher;
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 use crate::repo::Repo;
Simon Sapin
rust: Keep lazily-initialized Changelog and Manifest log on the Repo object...
r48773 use crate::revlog::manifest::Manifest;
Raphaël Gomès
rust-clippy: merge "revlog" module definition and struct implementation...
r50832 use crate::revlog::RevlogError;
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 use crate::utils::filter_map_results;
Antoine Cezar
hg-core: define a `ListTrackedFiles` `Operation`...
r45918 use crate::utils::hg_path::HgPath;
Antoine Cezar
hg-core: add a `ListRevTrackedFiles` operation...
r46107
/// List files under Mercurial control at a given revision.
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 pub fn list_rev_tracked_files(
Simon Sapin
rust: introduce Repo and Vfs types for filesystem abstraction...
r46782 repo: &Repo,
Simon Sapin
rhg: centralize parsing of `--rev` CLI arguments...
r47162 revset: &str,
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 narrow_matcher: Box<dyn Matcher>,
Simon Sapin
rust: remove three enums that were identical to `RevlogError`...
r47166 ) -> Result<FilesForRev, RevlogError> {
Simon Sapin
rhg: centralize parsing of `--rev` CLI arguments...
r47162 let rev = crate::revset::resolve_single(revset, repo)?;
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 Ok(FilesForRev {
Raphaël Gomès
rust: use the new `UncheckedRevision` everywhere applicable...
r51870 manifest: repo.manifest_for_rev(rev.into())?,
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 narrow_matcher,
})
Antoine Cezar
hg-core: add a `ListRevTrackedFiles` operation...
r46107 }
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 pub struct FilesForRev {
manifest: Manifest,
narrow_matcher: Box<dyn Matcher>,
}
Antoine Cezar
hg-core: add a `ListRevTrackedFiles` operation...
r46107
Simon Sapin
rust: replace most "operation" structs with functions...
r46751 impl FilesForRev {
Simon Sapin
rhg: Propogate manifest parse errors instead of panicking...
r49165 pub fn iter(&self) -> impl Iterator<Item = Result<&HgPath, HgError>> {
Raphaël Gomès
rhg-files: add support for narrow when specifying a revision...
r50880 filter_map_results(self.manifest.iter(), |entry| {
let path = entry.path;
Ok(if self.narrow_matcher.matches(path) {
Some(path)
} else {
None
})
})
Antoine Cezar
hg-core: add a `ListRevTrackedFiles` operation...
r46107 }
}