mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-12 07:14:38 +00:00
cli: use command helper to check if path argument is parsable as revset
There should be no reason to use low-level API.
This commit is contained in:
parent
12b873e1ef
commit
ba73accac6
2 changed files with 8 additions and 8 deletions
|
@ -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(),
|
||||
|
|
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue