mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 17:41:14 +00:00
cli: ensure log revset expression tree is optimized
I don't think we have any substitution rules applied to union or intersection with single file predicate, but there might be something in future.
This commit is contained in:
parent
e601a30b15
commit
458ae45905
1 changed files with 22 additions and 21 deletions
|
@ -1541,7 +1541,8 @@ fn cmd_status(
|
|||
fn cmd_log(ui: &mut Ui, command: &CommandHelper, args: &LogArgs) -> Result<(), CommandError> {
|
||||
let workspace_command = command.workspace_helper(ui)?;
|
||||
|
||||
let revset_expression = if args.revisions.is_empty() {
|
||||
let revset_expression = {
|
||||
let mut expression = if args.revisions.is_empty() {
|
||||
workspace_command.parse_revset(&command.settings().default_revset())?
|
||||
} else {
|
||||
let expressions: Vec<_> = args
|
||||
|
@ -1551,20 +1552,20 @@ fn cmd_log(ui: &mut Ui, command: &CommandHelper, args: &LogArgs) -> Result<(), C
|
|||
.try_collect()?;
|
||||
RevsetExpression::union_all(&expressions)
|
||||
};
|
||||
let repo = workspace_command.repo();
|
||||
let wc_commit_id = workspace_command.get_wc_commit_id();
|
||||
let revset_expression = if !args.paths.is_empty() {
|
||||
if !args.paths.is_empty() {
|
||||
let repo_paths: Vec<_> = args
|
||||
.paths
|
||||
.iter()
|
||||
.map(|path_arg| workspace_command.parse_file_path(path_arg))
|
||||
.try_collect()?;
|
||||
revset_expression.intersection(&RevsetExpression::filter(RevsetFilterPredicate::File(
|
||||
Some(repo_paths),
|
||||
)))
|
||||
} else {
|
||||
revset_expression
|
||||
expression = expression.intersection(&RevsetExpression::filter(
|
||||
RevsetFilterPredicate::File(Some(repo_paths)),
|
||||
));
|
||||
}
|
||||
revset::optimize(expression)
|
||||
};
|
||||
let repo = workspace_command.repo();
|
||||
let wc_commit_id = workspace_command.get_wc_commit_id();
|
||||
let matcher = workspace_command.matcher_from_values(&args.paths)?;
|
||||
let revset = workspace_command.evaluate_revset(revset_expression)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue