Mercurial > public > mercurial-scm > hg
view rust/rhg/src/commands/debugignorerhg.rs @ 50215:ae61851e6fe2 stable
dirstate: add a way to test races happening during status
We add the `devel.sync.status.pre-dirstate-write-file` config option to easily
test what happens when other operations happen during the window where
`hg status` is done working but has not updated the cache on disk yet.
We introduce the framework for testing such races too, actual tests will be
added in the next changesets. For now the test is only checking dirstate-v1. We
will extend the test coverage later too.
Check test documentation for details.
Code change from Rapha?l Gom?s <rgomes@octobus.net>
Test change from Pierre-Yves David <pierre-yves.david@octobus.net>
author | Rapha?l Gom?s <rgomes@octobus.net>, Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 28 Feb 2023 15:25:47 +0100 |
parents | 363923bd51cd |
children | 37bc3edef76f |
line wrap: on
line source
use crate::error::CommandError; use clap::SubCommand; 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::App<'static, 'static> { SubCommand::with_name("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().to_owned(), &mut |_source, _pattern_bytes| (), ) .map_err(|e| StatusError::from(e))?; 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(()) }