Mercurial > hg
view rust/rhg/src/commands/debugignorerhg.rs @ 51656:21442f87f7fa stable tip
mmap: only use mmap to read revlog persistent nodemap if it is safe
Cf `is_mmap_safe` docstring.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 03 Jul 2024 12:32:57 +0200 |
parents | 58074252db3c |
children |
line wrap: on
line source
use crate::error::CommandError; use hg; use hg::matchers::get_ignore_matcher; use hg::StatusError; use log::warn; pub const HELP_TEXT: &str = " Show effective hgignore patterns used by rhg. This is a pure Rust version of `hg debugignore`. Some options might be missing, check the list below. "; pub fn args() -> clap::Command { clap::command!("debugignorerhg").about(HELP_TEXT) } pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> { let repo = invocation.repo?; let ignore_file = repo.working_directory_vfs().join(".hgignore"); // TODO hardcoded let (ignore_matcher, warnings) = get_ignore_matcher( vec![ignore_file], repo.working_directory_path(), &mut |_source, _pattern_bytes| (), ) .map_err(StatusError::from)?; if !warnings.is_empty() { warn!("Pattern warnings: {:?}", &warnings); } let patterns = ignore_matcher.debug_get_patterns(); invocation.ui.write_stdout(patterns)?; invocation.ui.write_stdout(b"\n")?; Ok(()) }