From ba73accac6cff4741a16e70df83c0ceb93712463 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 10 May 2024 08:54:00 +0900 Subject: [PATCH] cli: use command helper to check if path argument is parsable as revset There should be no reason to use low-level API. --- cli/src/commands/log.rs | 6 ++++-- cli/src/commands/squash.rs | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cli/src/commands/log.rs b/cli/src/commands/log.rs index db12f6959..1b981fb89 100644 --- a/cli/src/commands/log.rs +++ b/cli/src/commands/log.rs @@ -14,7 +14,7 @@ use jj_lib::backend::CommitId; use jj_lib::repo::Repo; -use jj_lib::revset::{self, RevsetExpression, RevsetFilterPredicate, RevsetIteratorExt}; +use jj_lib::revset::{RevsetExpression, RevsetFilterPredicate, RevsetIteratorExt}; use jj_lib::revset_graph::{ ReverseRevsetGraphIterator, RevsetGraphEdgeType, TopoGroupedRevsetGraphIterator, }; @@ -262,7 +262,9 @@ pub(crate) fn cmd_log( working copy commit, pass -r '@' instead." )?; } else if revset.is_empty() - && revset::parse(only_path, &workspace_command.revset_parse_context()).is_ok() + && workspace_command + .parse_revset(&RevisionArg::from(only_path.to_owned())) + .is_ok() { writeln!( ui.warning_default(), diff --git a/cli/src/commands/squash.rs b/cli/src/commands/squash.rs index a76c2adbf..825666351 100644 --- a/cli/src/commands/squash.rs +++ b/cli/src/commands/squash.rs @@ -18,7 +18,6 @@ use jj_lib::matchers::Matcher; use jj_lib::merged_tree::MergedTree; use jj_lib::object_id::ObjectId; use jj_lib::repo::Repo; -use jj_lib::revset; use jj_lib::settings::UserSettings; use tracing::instrument; @@ -234,11 +233,10 @@ from the source will be moved into the destination. if let [only_path] = path_arg { if no_rev_arg - && revset::parse( - only_path, - &tx.base_workspace_helper().revset_parse_context(), - ) - .is_ok() + && tx + .base_workspace_helper() + .parse_revset(&RevisionArg::from(only_path.to_owned())) + .is_ok() { writeln!( ui.warning_default(),