##// END OF EJS Templates
rust-changelog: introducing an intermediate `ChangelogEntry`...
rust-changelog: introducing an intermediate `ChangelogEntry` Before this change, client code needing to extract, e.g, the Node ID and the description from a changeset had no other choice than calling both `entry_for_rev()` and `data_for_rev()`. This duplicates some (limited) computation, and more importantly imposes bad hygiene for client code: at some point of developement, the client code would have to pass over both entry and data in its internal layers, which at some point of development would raise the question whether they are consistent. We introduce the intermediate `ChangelogEntry` from which both conversion to the generic `RevlogEntry` and extraction of `ChangelogRevisionData` are possible. It might grow some convenience methods in the future. We keep the `data_for_rev()` method of `Changelog` for compatibility, pointing users at the more powerful alternative.

File last commit:

r50809:58074252 default
r51268:841b13e6 default
Show More
debugignorerhg.rs
39 lines | 1.0 KiB | application/rls-services+xml | RustLexer
/ rust / rhg / src / commands / debugignorerhg.rs
Arseniy Alekseyev
rhg: implement the debugignorerhg subcommand...
r49178 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.
";
Raphaël Gomès
rhg: upgrade `clap` dependency...
r50534 pub fn args() -> clap::Command {
clap::command!("debugignorerhg").about(HELP_TEXT)
Arseniy Alekseyev
rhg: implement the debugignorerhg subcommand...
r49178 }
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],
Raphaël Gomès
rust: run `cargo clippy`...
r50809 repo.working_directory_path(),
Raphaël Gomès
dirstate-v2: hash the source of the ignore patterns as well...
r50453 &mut |_source, _pattern_bytes| (),
Arseniy Alekseyev
rhg: implement the debugignorerhg subcommand...
r49178 )
Raphaël Gomès
rust: run `cargo clippy`...
r50809 .map_err(StatusError::from)?;
Arseniy Alekseyev
rhg: implement the debugignorerhg subcommand...
r49178
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(())
}