Mercurial > public > mercurial-scm > hg
diff rust/rhg/src/error.rs @ 50863:c112cc9effdc
rhg: support "status FILE"
This change adds a new [file] argument to rhg status, parses them as
patterns, canonicalizes the paths, and constructs a new PatternMatcher
to intersect with the existing matcher being passed to the status
implementation.
We also make filepatterns a public module so we can access the
pattern-parsing functionality we need from commands/status.rs.
author | Spencer Baugh <sbaugh@janestreet.com> |
---|---|
date | Wed, 02 Aug 2023 10:46:47 -0400 |
parents | 750409505286 |
children | 652149ed64f0 |
line wrap: on
line diff
--- a/rust/rhg/src/error.rs Wed Aug 02 10:16:33 2023 -0400 +++ b/rust/rhg/src/error.rs Wed Aug 02 10:46:47 2023 -0400 @@ -10,7 +10,8 @@ use hg::revlog::RevlogError; use hg::sparse::SparseConfigError; use hg::utils::files::get_bytes_from_path; -use hg::{DirstateError, DirstateMapError, StatusError}; +use hg::utils::hg_path::HgPathError; +use hg::{DirstateError, DirstateMapError, PatternError, StatusError}; use std::convert::From; /// The kind of command error @@ -230,6 +231,18 @@ } } +impl From<HgPathError> for CommandError { + fn from(error: HgPathError) -> Self { + CommandError::unsupported(format!("{}", error)) + } +} + +impl From<PatternError> for CommandError { + fn from(error: PatternError) -> Self { + CommandError::unsupported(format!("{}", error)) + } +} + impl From<DirstateMapError> for CommandError { fn from(error: DirstateMapError) -> Self { CommandError::abort(format!("{}", error))