mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-01 00:50:57 +00:00
cli: replace last use of evaluate_revset() with evaluate_programmatic()
evaluate_programmatic() should be allowed here. AFAIK, the contract is that the expression should never contain any bare symbols and "fallible" symbol-like expressions, which doesn't apply to branches() and remote_branches() functions. evaluate_revset() is removed because there are no callers. However, it's simple and basic function, so we might want to reintroduce it if needed.
This commit is contained in:
parent
b3d3b26656
commit
6004efb3b2
2 changed files with 3 additions and 10 deletions
|
@ -52,8 +52,8 @@ use jj_lib::repo::{
|
||||||
};
|
};
|
||||||
use jj_lib::repo_path::{FsPathParseError, RepoPath, RepoPathBuf};
|
use jj_lib::repo_path::{FsPathParseError, RepoPath, RepoPathBuf};
|
||||||
use jj_lib::revset::{
|
use jj_lib::revset::{
|
||||||
Revset, RevsetAliasesMap, RevsetCommitRef, RevsetExpression, RevsetFilterPredicate,
|
RevsetAliasesMap, RevsetCommitRef, RevsetExpression, RevsetFilterPredicate, RevsetIteratorExt,
|
||||||
RevsetIteratorExt, RevsetParseContext, RevsetWorkspaceContext,
|
RevsetParseContext, RevsetWorkspaceContext,
|
||||||
};
|
};
|
||||||
use jj_lib::rewrite::restore_tree;
|
use jj_lib::rewrite::restore_tree;
|
||||||
use jj_lib::settings::{ConfigResultExt as _, UserSettings};
|
use jj_lib::settings::{ConfigResultExt as _, UserSettings};
|
||||||
|
@ -880,13 +880,6 @@ impl WorkspaceCommandHelper {
|
||||||
self.attach_revset_evaluator(expression)
|
self.attach_revset_evaluator(expression)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn evaluate_revset<'repo>(
|
|
||||||
&'repo self,
|
|
||||||
expression: Rc<RevsetExpression>,
|
|
||||||
) -> Result<Box<dyn Revset + 'repo>, CommandError> {
|
|
||||||
Ok(self.attach_revset_evaluator(expression)?.evaluate()?)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn attach_revset_evaluator(
|
fn attach_revset_evaluator(
|
||||||
&self,
|
&self,
|
||||||
expression: Rc<RevsetExpression>,
|
expression: Rc<RevsetExpression>,
|
||||||
|
|
|
@ -1192,7 +1192,7 @@ fn find_branches_targeted_by_revisions<'a>(
|
||||||
.range(&RevsetExpression::commit(wc_commit_id))
|
.range(&RevsetExpression::commit(wc_commit_id))
|
||||||
.intersection(&RevsetExpression::branches(StringPattern::everything()));
|
.intersection(&RevsetExpression::branches(StringPattern::everything()));
|
||||||
let current_branches_revset =
|
let current_branches_revset =
|
||||||
workspace_command.evaluate_revset(current_branches_expression)?;
|
current_branches_expression.evaluate_programmatic(workspace_command.repo().as_ref())?;
|
||||||
revision_commit_ids.extend(current_branches_revset.iter());
|
revision_commit_ids.extend(current_branches_revset.iter());
|
||||||
if revision_commit_ids.is_empty() {
|
if revision_commit_ids.is_empty() {
|
||||||
writeln!(
|
writeln!(
|
||||||
|
|
Loading…
Reference in a new issue