##// END OF EJS Templates
rust-filepatterns: export glob_to_re function...
rust-filepatterns: export glob_to_re function Making this function public should not risk freezing the internal API, and it can be useful for all downstream code that needs to perform glob matching against byte strings, such as RHGitaly where it will be useful to match on branches and tags.

File last commit:

r51870:1928b770 default
r52363:406b413e stable
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 }
}