forked from mirrors/jj
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::backend::CommitId;
|
||||||
use jj_lib::repo::Repo;
|
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::{
|
use jj_lib::revset_graph::{
|
||||||
ReverseRevsetGraphIterator, RevsetGraphEdgeType, TopoGroupedRevsetGraphIterator,
|
ReverseRevsetGraphIterator, RevsetGraphEdgeType, TopoGroupedRevsetGraphIterator,
|
||||||
};
|
};
|
||||||
|
@ -262,7 +262,9 @@ pub(crate) fn cmd_log(
|
||||||
working copy commit, pass -r '@' instead."
|
working copy commit, pass -r '@' instead."
|
||||||
)?;
|
)?;
|
||||||
} else if revset.is_empty()
|
} 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!(
|
writeln!(
|
||||||
ui.warning_default(),
|
ui.warning_default(),
|
||||||
|
|
|
@ -18,7 +18,6 @@ use jj_lib::matchers::Matcher;
|
||||||
use jj_lib::merged_tree::MergedTree;
|
use jj_lib::merged_tree::MergedTree;
|
||||||
use jj_lib::object_id::ObjectId;
|
use jj_lib::object_id::ObjectId;
|
||||||
use jj_lib::repo::Repo;
|
use jj_lib::repo::Repo;
|
||||||
use jj_lib::revset;
|
|
||||||
use jj_lib::settings::UserSettings;
|
use jj_lib::settings::UserSettings;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
|
@ -234,10 +233,9 @@ from the source will be moved into the destination.
|
||||||
|
|
||||||
if let [only_path] = path_arg {
|
if let [only_path] = path_arg {
|
||||||
if no_rev_arg
|
if no_rev_arg
|
||||||
&& revset::parse(
|
&& tx
|
||||||
only_path,
|
.base_workspace_helper()
|
||||||
&tx.base_workspace_helper().revset_parse_context(),
|
.parse_revset(&RevisionArg::from(only_path.to_owned()))
|
||||||
)
|
|
||||||
.is_ok()
|
.is_ok()
|
||||||
{
|
{
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|
Loading…
Reference in a new issue