cli: map RevsetError to CommandError early

I'm going to split RevsetError into symbol resolution and evaluation errors,
and evaluate_revset() is the only place where CLI crate explicitly specifies
RevsetError type.
This commit is contained in:
Yuya Nishihara 2023-04-02 10:54:45 +09:00
parent 6c5947181d
commit f2e0836b1e

View file

@ -865,13 +865,13 @@ impl WorkspaceCommandHelper {
pub fn evaluate_revset<'repo>(
&'repo self,
revset_expression: Rc<RevsetExpression>,
) -> Result<Box<dyn Revset<'repo> + 'repo>, RevsetError> {
) -> Result<Box<dyn Revset<'repo> + 'repo>, CommandError> {
let revset_expression = resolve_symbols(
self.repo.as_ref(),
revset_expression,
Some(&self.revset_context()),
)?;
revset_expression.evaluate(self.repo.as_ref())
Ok(revset_expression.evaluate(self.repo.as_ref())?)
}
fn revset_context(&self) -> RevsetWorkspaceContext {