ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: remove last use of resolve_multiple_nonempty_revsets() from cmd_run()

This commit is contained in:
Yuya Nishihara 2024-03-17 12:30:06 +09:00
parent 933150d819
commit 54bb3b4114
2 changed files with 11 additions and 17 deletions

View file

@ -1620,21 +1620,6 @@ pub fn resolve_all_revs(
} }
} }
pub fn resolve_multiple_nonempty_revsets(
revision_args: &[RevisionArg],
workspace_command: &WorkspaceCommandHelper,
) -> Result<IndexSet<Commit>, CommandError> {
let mut acc = IndexSet::new();
for revset in revision_args {
let revisions = workspace_command.resolve_revset(revset)?;
if revisions.is_empty() {
return Err(user_error("Empty revision set"));
}
acc.extend(revisions);
}
Ok(acc)
}
pub fn resolve_multiple_nonempty_revsets_default_single( pub fn resolve_multiple_nonempty_revsets_default_single(
workspace_command: &WorkspaceCommandHelper, workspace_command: &WorkspaceCommandHelper,
revisions: &[RevisionArg], revisions: &[RevisionArg],

View file

@ -14,7 +14,11 @@
//! This file contains the internal implementation of `run`. //! This file contains the internal implementation of `run`.
use crate::cli_util::{resolve_multiple_nonempty_revsets, CommandHelper, RevisionArg}; use itertools::Itertools as _;
use jj_lib::repo::Repo as _;
use jj_lib::revset::RevsetIteratorExt as _;
use crate::cli_util::{CommandHelper, RevisionArg};
use crate::command_error::{user_error, CommandError}; use crate::command_error::{user_error, CommandError};
use crate::ui::Ui; use crate::ui::Ui;
@ -48,7 +52,12 @@ pub struct RunArgs {
pub fn cmd_run(ui: &mut Ui, command: &CommandHelper, args: &RunArgs) -> Result<(), CommandError> { pub fn cmd_run(ui: &mut Ui, command: &CommandHelper, args: &RunArgs) -> Result<(), CommandError> {
let workspace_command = command.workspace_helper(ui)?; let workspace_command = command.workspace_helper(ui)?;
let _resolved_commits = resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command)?; let _resolved_commits: Vec<_> = {
let repo = workspace_command.repo();
let expression = workspace_command.parse_union_revsets(&args.revisions)?;
let revset = workspace_command.evaluate_revset(expression)?;
revset.iter().commits(repo.store()).try_collect()?
};
// Jobs are resolved in this order: // Jobs are resolved in this order:
// 1. Commandline argument iff > 0. // 1. Commandline argument iff > 0.
// 2. the amount of cores available. // 2. the amount of cores available.