diff --git a/cli/examples/custom-command/main.rs b/cli/examples/custom-command/main.rs index 7c1b607bc0..bdcf657491 100644 --- a/cli/examples/custom-command/main.rs +++ b/cli/examples/custom-command/main.rs @@ -38,7 +38,7 @@ fn run_custom_command( match command { CustomCommand::Frobnicate(args) => { let mut workspace_command = command_helper.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let mut tx = workspace_command.start_transaction(); let new_commit = tx .mut_repo() diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 416afb3d9b..d9e0b3c5c5 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1091,12 +1091,8 @@ impl WorkspaceCommandHelper { /// Resolve a revset to a single revision. Return an error if the revset is /// empty or has multiple revisions. - pub fn resolve_single_rev( - &self, - revision_str: &str, - ui: &mut Ui, - ) -> Result { - let revset_expression = self.parse_revset(revision_str, Some(ui))?; + pub fn resolve_single_rev(&self, revision_str: &str) -> Result { + let revset_expression = self.parse_revset(revision_str)?; let revset = self.evaluate_revset(revset_expression.clone())?; let mut iter = revset.iter().commits(self.repo().store()).fuse(); match (iter.next(), iter.next()) { @@ -1145,12 +1141,8 @@ Set which revision the branch points to with `jj branch set {branch_name} -r Result, CommandError> { - let revset_expression = self.parse_revset(revision_str, Some(ui))?; + pub fn resolve_revset(&self, revision_str: &str) -> Result, CommandError> { + let revset_expression = self.parse_revset(revision_str)?; let revset = self.evaluate_revset(revset_expression)?; Ok(revset.iter().commits(self.repo().store()).try_collect()?) } @@ -1161,13 +1153,12 @@ Set which revision the branch points to with `jj branch set {branch_name} -r Result, CommandError> { // TODO: Let pest parse the prefix too once we've dropped support for `:` if let Some(revision_str) = revision_str.strip_prefix("all:") { - self.resolve_revset(revision_str, ui) + self.resolve_revset(revision_str) } else { - self.resolve_single_rev(revision_str, ui) + self.resolve_single_rev(revision_str) .map_err(|err| match err { CommandError::UserError { err, hint } => CommandError::UserError { err, @@ -1187,65 +1178,8 @@ Set which revision the branch points to with `jj branch set {branch_name} -r , ) -> Result, RevsetParseError> { let expression = revset::parse(revision_str, &self.revset_parse_context())?; - if let Some(ui) = ui { - fn has_legacy_rule(expression: &Rc) -> bool { - match expression.as_ref() { - RevsetExpression::None => false, - RevsetExpression::All => false, - RevsetExpression::Commits(_) => false, - RevsetExpression::CommitRef(_) => false, - RevsetExpression::Ancestors { - heads, - generation: _, - is_legacy, - } => *is_legacy || has_legacy_rule(heads), - RevsetExpression::Descendants { - roots, - generation: _, - is_legacy, - } => *is_legacy || has_legacy_rule(roots), - RevsetExpression::Range { - roots, - heads, - generation: _, - } => has_legacy_rule(roots) || has_legacy_rule(heads), - RevsetExpression::DagRange { - roots, - heads, - is_legacy, - } => *is_legacy || has_legacy_rule(roots) || has_legacy_rule(heads), - RevsetExpression::Heads(expression) => has_legacy_rule(expression), - RevsetExpression::Roots(expression) => has_legacy_rule(expression), - RevsetExpression::Latest { - candidates, - count: _, - } => has_legacy_rule(candidates), - RevsetExpression::Filter(_) => false, - RevsetExpression::AsFilter(expression) => has_legacy_rule(expression), - RevsetExpression::Present(expression) => has_legacy_rule(expression), - RevsetExpression::NotIn(expression) => has_legacy_rule(expression), - RevsetExpression::Union(expression1, expression2) => { - has_legacy_rule(expression1) || has_legacy_rule(expression2) - } - RevsetExpression::Intersection(expression1, expression2) => { - has_legacy_rule(expression1) || has_legacy_rule(expression2) - } - RevsetExpression::Difference(expression1, expression2) => { - has_legacy_rule(expression1) || has_legacy_rule(expression2) - } - } - } - if has_legacy_rule(&expression) { - writeln!( - ui.warning(), - "The `:` revset operator is deprecated. Please switch to `::`." - ) - .ok(); - } - } Ok(revset::optimize(expression)) } @@ -1293,12 +1227,9 @@ Set which revision the branch points to with `jj branch set {branch_name} -r Result Result, CommandError> { - let commits = - resolve_multiple_nonempty_revsets_default_single(workspace_command, ui, revisions)?; + let commits = resolve_multiple_nonempty_revsets_default_single(workspace_command, revisions)?; let root_commit_id = workspace_command.repo().store().root_commit_id(); if commits.len() >= 2 && commits.iter().any(|c| c.id() == root_commit_id) { Err(user_error("Cannot merge with root revision")) @@ -2118,11 +2047,10 @@ fn load_revset_aliases( pub fn resolve_multiple_nonempty_revsets( revision_args: &[RevisionArg], workspace_command: &WorkspaceCommandHelper, - ui: &mut Ui, ) -> Result, CommandError> { let mut acc = IndexSet::new(); for revset in revision_args { - let revisions = workspace_command.resolve_revset(revset, ui)?; + let revisions = workspace_command.resolve_revset(revset)?; workspace_command.check_non_empty(&revisions)?; acc.extend(revisions); } @@ -2131,12 +2059,11 @@ pub fn resolve_multiple_nonempty_revsets( pub fn resolve_multiple_nonempty_revsets_default_single( workspace_command: &WorkspaceCommandHelper, - ui: &mut Ui, revisions: &[RevisionArg], ) -> Result, CommandError> { let mut all_commits = IndexSet::new(); for revision_str in revisions { - let commits = workspace_command.resolve_revset_default_single(revision_str, ui)?; + let commits = workspace_command.resolve_revset_default_single(revision_str)?; workspace_command.check_non_empty(&commits)?; for commit in commits { let commit_hash = short_commit_hash(commit.id()); diff --git a/cli/src/commands/abandon.rs b/cli/src/commands/abandon.rs index 7ff0fa517a..2b3f8ab512 100644 --- a/cli/src/commands/abandon.rs +++ b/cli/src/commands/abandon.rs @@ -47,7 +47,7 @@ pub(crate) fn cmd_abandon( args: &AbandonArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let to_abandon = resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command, ui)?; + let to_abandon = resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command)?; workspace_command.check_rewritable(to_abandon.iter())?; let mut tx = workspace_command.start_transaction(); for commit in &to_abandon { diff --git a/cli/src/commands/backout.rs b/cli/src/commands/backout.rs index d8de613970..abfd009b1c 100644 --- a/cli/src/commands/backout.rs +++ b/cli/src/commands/backout.rs @@ -39,10 +39,10 @@ pub(crate) fn cmd_backout( args: &BackoutArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let commit_to_back_out = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit_to_back_out = workspace_command.resolve_single_rev(&args.revision)?; let mut parents = vec![]; for revision_str in &args.destination { - let destination = workspace_command.resolve_single_rev(revision_str, ui)?; + let destination = workspace_command.resolve_single_rev(revision_str)?; parents.push(destination); } let mut tx = workspace_command.start_transaction(); diff --git a/cli/src/commands/bench.rs b/cli/src/commands/bench.rs index b8fef0a34d..49b3c6ab7e 100644 --- a/cli/src/commands/bench.rs +++ b/cli/src/commands/bench.rs @@ -132,8 +132,8 @@ pub(crate) fn cmd_bench( match subcommand { BenchCommand::CommonAncestors(args) => { let workspace_command = command.workspace_helper(ui)?; - let commit1 = workspace_command.resolve_single_rev(&args.revision1, ui)?; - let commit2 = workspace_command.resolve_single_rev(&args.revision2, ui)?; + let commit1 = workspace_command.resolve_single_rev(&args.revision1)?; + let commit2 = workspace_command.resolve_single_rev(&args.revision2)?; let index = workspace_command.repo().index(); let routine = || index.common_ancestors(&[commit1.id().clone()], &[commit2.id().clone()]); @@ -146,8 +146,8 @@ pub(crate) fn cmd_bench( } BenchCommand::IsAncestor(args) => { let workspace_command = command.workspace_helper(ui)?; - let ancestor_commit = workspace_command.resolve_single_rev(&args.ancestor, ui)?; - let descendant_commit = workspace_command.resolve_single_rev(&args.descendant, ui)?; + let ancestor_commit = workspace_command.resolve_single_rev(&args.ancestor)?; + let descendant_commit = workspace_command.resolve_single_rev(&args.descendant)?; let index = workspace_command.repo().index(); let routine = || index.is_ancestor(ancestor_commit.id(), descendant_commit.id()); run_bench( @@ -201,7 +201,7 @@ fn bench_revset( revset: &str, ) -> Result<(), CommandError> { writeln!(ui.stderr(), "----------Testing revset: {revset}----------")?; - let expression = workspace_command.parse_revset(revset, Some(ui))?; + let expression = workspace_command.parse_revset(revset)?; // Time both evaluation and iteration. let routine = |workspace_command: &WorkspaceCommandHelper, expression| { workspace_command diff --git a/cli/src/commands/branch.rs b/cli/src/commands/branch.rs index 444d52e863..570da5d78a 100644 --- a/cli/src/commands/branch.rs +++ b/cli/src/commands/branch.rs @@ -234,7 +234,7 @@ fn cmd_branch_create( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; let target_commit = - workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"))?; let view = workspace_command.repo().view(); let branch_names = &args.names; if let Some(branch_name) = branch_names @@ -333,7 +333,7 @@ fn cmd_branch_set( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; let target_commit = - workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"))?; let repo = workspace_command.repo().as_ref(); let is_fast_forward = |old_target: &RefTarget| { // Strictly speaking, "all" old targets should be ancestors, but we allow @@ -614,7 +614,7 @@ fn cmd_branch_list( let filter_expressions: Vec<_> = args .revisions .iter() - .map(|revision_str| workspace_command.parse_revset(revision_str, Some(ui))) + .map(|revision_str| workspace_command.parse_revset(revision_str)) .try_collect()?; let filter_expression = RevsetExpression::union_all(&filter_expressions); // Intersects with the set of local branch targets to minimize the lookup space. diff --git a/cli/src/commands/cat.rs b/cli/src/commands/cat.rs index b10fa5882a..840b6960f5 100644 --- a/cli/src/commands/cat.rs +++ b/cli/src/commands/cat.rs @@ -40,7 +40,7 @@ pub(crate) fn cmd_cat( args: &CatArgs, ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let tree = commit.tree()?; let path = workspace_command.parse_file_path(&args.path)?; let repo = workspace_command.repo(); diff --git a/cli/src/commands/checkout.rs b/cli/src/commands/checkout.rs index 667c5d41ef..7d446faedc 100644 --- a/cli/src/commands/checkout.rs +++ b/cli/src/commands/checkout.rs @@ -50,7 +50,7 @@ pub(crate) fn cmd_checkout( "warning: `jj checkout` will be removed in a future version, and this will be a hard error" )?; let mut workspace_command = command.workspace_helper(ui)?; - let target = workspace_command.resolve_single_rev(&args.revision, ui)?; + let target = workspace_command.resolve_single_rev(&args.revision)?; let mut tx = workspace_command.start_transaction(); let commit_builder = tx .mut_repo() diff --git a/cli/src/commands/chmod.rs b/cli/src/commands/chmod.rs index 955de020e2..6c91a427fe 100644 --- a/cli/src/commands/chmod.rs +++ b/cli/src/commands/chmod.rs @@ -64,7 +64,7 @@ pub(crate) fn cmd_chmod( .iter() .map(|path| workspace_command.parse_file_path(path)) .try_collect()?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&commit])?; let mut tx = workspace_command.start_transaction(); diff --git a/cli/src/commands/debug.rs b/cli/src/commands/debug.rs index d2b670ff2a..f458b17f18 100644 --- a/cli/src/commands/debug.rs +++ b/cli/src/commands/debug.rs @@ -291,7 +291,7 @@ fn cmd_debug_tree( args: &DebugTreeArgs, ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let tree = commit.tree()?; let matcher = workspace_command.matcher_from_values(&args.paths)?; for (path, value) in tree.entries_matching(matcher.as_ref()) { diff --git a/cli/src/commands/describe.rs b/cli/src/commands/describe.rs index a59da7c089..c6d15eb16b 100644 --- a/cli/src/commands/describe.rs +++ b/cli/src/commands/describe.rs @@ -64,7 +64,7 @@ pub(crate) fn cmd_describe( args: &DescribeArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&commit])?; let description = if args.stdin { let mut buffer = String::new(); diff --git a/cli/src/commands/diff.rs b/cli/src/commands/diff.rs index f0d0a83ce1..1a1706e426 100644 --- a/cli/src/commands/diff.rs +++ b/cli/src/commands/diff.rs @@ -52,13 +52,13 @@ pub(crate) fn cmd_diff( let from_tree; let to_tree; if args.from.is_some() || args.to.is_some() { - let from = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?; + let from = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?; from_tree = from.tree()?; - let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?; + let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?; to_tree = to.tree()?; } else { let commit = - workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"))?; let parents = commit.parents(); from_tree = merge_commit_trees(workspace_command.repo().as_ref(), &parents)?; to_tree = commit.tree()? diff --git a/cli/src/commands/diffedit.rs b/cli/src/commands/diffedit.rs index 45acf1a488..d077237fd9 100644 --- a/cli/src/commands/diffedit.rs +++ b/cli/src/commands/diffedit.rs @@ -62,17 +62,16 @@ pub(crate) fn cmd_diffedit( let (target_commit, base_commits, diff_description); if args.from.is_some() || args.to.is_some() { - target_commit = - workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?; + target_commit = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?; base_commits = - vec![workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?]; + vec![workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?]; diff_description = format!( "The diff initially shows the commit's changes relative to:\n{}", workspace_command.format_commit_summary(&base_commits[0]) ); } else { target_commit = - workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.revision.as_deref().unwrap_or("@"))?; base_commits = target_commit.parents(); diff_description = "The diff initially shows the commit's changes.".to_string(); }; diff --git a/cli/src/commands/duplicate.rs b/cli/src/commands/duplicate.rs index 6dafe44973..703bdd9597 100644 --- a/cli/src/commands/duplicate.rs +++ b/cli/src/commands/duplicate.rs @@ -44,7 +44,7 @@ pub(crate) fn cmd_duplicate( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; let to_duplicate: IndexSet = - resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command, ui)?; + resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command)?; if to_duplicate .iter() .any(|commit| commit.id() == workspace_command.repo().store().root_commit_id()) diff --git a/cli/src/commands/edit.rs b/cli/src/commands/edit.rs index 2d3d92b833..f48aecb048 100644 --- a/cli/src/commands/edit.rs +++ b/cli/src/commands/edit.rs @@ -40,7 +40,7 @@ pub(crate) fn cmd_edit( args: &EditArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let new_commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let new_commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&new_commit])?; if workspace_command.get_wc_commit_id() == Some(new_commit.id()) { writeln!(ui.stderr(), "Already editing that commit")?; diff --git a/cli/src/commands/files.rs b/cli/src/commands/files.rs index a714a39cf2..bbc3df4b8f 100644 --- a/cli/src/commands/files.rs +++ b/cli/src/commands/files.rs @@ -37,7 +37,7 @@ pub(crate) fn cmd_files( args: &FilesArgs, ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let tree = commit.tree()?; let matcher = workspace_command.matcher_from_values(&args.paths)?; ui.request_pager(); diff --git a/cli/src/commands/git.rs b/cli/src/commands/git.rs index 8831721512..3c6990ea43 100644 --- a/cli/src/commands/git.rs +++ b/cli/src/commands/git.rs @@ -775,7 +775,7 @@ fn cmd_git_push( let change_commits: Vec<_> = args .change .iter() - .map(|change_str| workspace_command.resolve_single_rev(change_str, ui)) + .map(|change_str| workspace_command.resolve_single_rev(change_str)) .try_collect()?; let mut tx = workspace_command.start_transaction(); @@ -845,7 +845,7 @@ fn cmd_git_push( let short_change_id = short_change_hash(commit.change_id()); if tx .base_workspace_helper() - .resolve_single_rev(&short_change_id, ui) + .resolve_single_rev(&short_change_id) .is_ok() { // Short change ID is not ambiguous, so update the branch name to use it. @@ -899,7 +899,7 @@ fn cmd_git_push( } else { // TODO: Narrow search space to local target commits. // TODO: Remove redundant CommitId -> Commit -> CommitId round trip. - resolve_multiple_nonempty_revsets(&args.revisions, tx.base_workspace_helper(), ui)? + resolve_multiple_nonempty_revsets(&args.revisions, tx.base_workspace_helper())? .iter() .map(|commit| commit.id().clone()) .collect() @@ -1215,7 +1215,7 @@ fn cmd_git_submodule_print_gitmodules( ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; let repo = workspace_command.repo(); - let commit = workspace_command.resolve_single_rev(&args.revisions, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revisions)?; let tree = commit.tree()?; let gitmodules_path = RepoPath::from_internal_string(".gitmodules"); let mut gitmodules_file = match tree.path_value(gitmodules_path).into_resolved() { diff --git a/cli/src/commands/interdiff.rs b/cli/src/commands/interdiff.rs index 74f0403dd2..b83f5f3b69 100644 --- a/cli/src/commands/interdiff.rs +++ b/cli/src/commands/interdiff.rs @@ -48,8 +48,8 @@ pub(crate) fn cmd_interdiff( args: &InterdiffArgs, ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let from = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?; - let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?; + let from = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?; + let to = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?; let from_tree = rebase_to_dest_parent(workspace_command.repo().as_ref(), &from, &to)?; let to_tree = to.tree()?; diff --git a/cli/src/commands/log.rs b/cli/src/commands/log.rs index 9324cfd667..864b9b3c13 100644 --- a/cli/src/commands/log.rs +++ b/cli/src/commands/log.rs @@ -70,12 +70,12 @@ pub(crate) fn cmd_log( let revset_expression = { let mut expression = if args.revisions.is_empty() { - workspace_command.parse_revset(&command.settings().default_revset(), Some(ui))? + workspace_command.parse_revset(&command.settings().default_revset())? } else { let expressions: Vec<_> = args .revisions .iter() - .map(|revision_str| workspace_command.parse_revset(revision_str, Some(ui))) + .map(|revision_str| workspace_command.parse_revset(revision_str)) .try_collect()?; RevsetExpression::union_all(&expressions) }; diff --git a/cli/src/commands/move.rs b/cli/src/commands/move.rs index a2cf1de5ae..59e18bb610 100644 --- a/cli/src/commands/move.rs +++ b/cli/src/commands/move.rs @@ -58,9 +58,9 @@ pub(crate) fn cmd_move( args: &MoveArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let source = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)?; + let source = workspace_command.resolve_single_rev(args.from.as_deref().unwrap_or("@"))?; let mut destination = - workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?; if source.id() == destination.id() { return Err(user_error("Source and destination cannot be the same.")); } diff --git a/cli/src/commands/new.rs b/cli/src/commands/new.rs index 6435bb2f6d..e17657996b 100644 --- a/cli/src/commands/new.rs +++ b/cli/src/commands/new.rs @@ -98,7 +98,7 @@ Please use `jj new 'all:x|y'` instead of `jj new --allow-large-revsets x y`.", !args.revisions.is_empty(), "expected a non-empty list from clap" ); - let target_commits = cli_util::resolve_all_revs(&workspace_command, ui, &args.revisions)? + let target_commits = cli_util::resolve_all_revs(&workspace_command, &args.revisions)? .into_iter() .collect_vec(); let target_ids = target_commits.iter().map(|c| c.id().clone()).collect_vec(); diff --git a/cli/src/commands/obslog.rs b/cli/src/commands/obslog.rs index 29e52f99e2..fccd1131f6 100644 --- a/cli/src/commands/obslog.rs +++ b/cli/src/commands/obslog.rs @@ -63,7 +63,7 @@ pub(crate) fn cmd_obslog( ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let start_commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let start_commit = workspace_command.resolve_single_rev(&args.revision)?; let wc_commit_id = workspace_command.get_wc_commit_id(); let diff_formats = diff --git a/cli/src/commands/rebase.rs b/cli/src/commands/rebase.rs index 5586ae8f5e..dabda33989 100644 --- a/cli/src/commands/rebase.rs +++ b/cli/src/commands/rebase.rs @@ -186,7 +186,7 @@ Please use `jj rebase -d 'all:x|y'` instead of `jj rebase --allow-large-revsets }, }; let mut workspace_command = command.workspace_helper(ui)?; - let new_parents = cli_util::resolve_all_revs(&workspace_command, ui, &args.destination)? + let new_parents = cli_util::resolve_all_revs(&workspace_command, &args.destination)? .into_iter() .collect_vec(); if let Some(rev_str) = &args.revision { @@ -214,7 +214,7 @@ Please use `jj rebase -d 'all:x|y'` instead of `jj rebase --allow-large-revsets )?; } else if !args.source.is_empty() { let source_commits = - resolve_multiple_nonempty_revsets_default_single(&workspace_command, ui, &args.source)?; + resolve_multiple_nonempty_revsets_default_single(&workspace_command, &args.source)?; rebase_descendants( ui, command.settings(), @@ -225,9 +225,9 @@ Please use `jj rebase -d 'all:x|y'` instead of `jj rebase --allow-large-revsets )?; } else { let branch_commits = if args.branch.is_empty() { - IndexSet::from([workspace_command.resolve_single_rev("@", ui)?]) + IndexSet::from([workspace_command.resolve_single_rev("@")?]) } else { - resolve_multiple_nonempty_revsets_default_single(&workspace_command, ui, &args.branch)? + resolve_multiple_nonempty_revsets_default_single(&workspace_command, &args.branch)? }; rebase_branch( ui, @@ -323,7 +323,7 @@ fn rebase_revision( new_parents: &[Commit], rev_str: &str, ) -> Result<(), CommandError> { - let old_commit = workspace_command.resolve_single_rev(rev_str, ui)?; + let old_commit = workspace_command.resolve_single_rev(rev_str)?; workspace_command.check_rewritable([&old_commit])?; if new_parents.contains(&old_commit) { return Err(user_error(format!( diff --git a/cli/src/commands/resolve.rs b/cli/src/commands/resolve.rs index bce39199eb..9f4260a515 100644 --- a/cli/src/commands/resolve.rs +++ b/cli/src/commands/resolve.rs @@ -70,7 +70,7 @@ pub(crate) fn cmd_resolve( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; let matcher = workspace_command.matcher_from_values(&args.paths)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let tree = commit.tree()?; let conflicts = tree .conflicts() diff --git a/cli/src/commands/restore.rs b/cli/src/commands/restore.rs index e54fead8f3..f9d11bdb6f 100644 --- a/cli/src/commands/restore.rs +++ b/cli/src/commands/restore.rs @@ -85,13 +85,13 @@ pub(crate) fn cmd_restore( )); } if args.from.is_some() || args.to.is_some() { - to_commit = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"), ui)?; + to_commit = workspace_command.resolve_single_rev(args.to.as_deref().unwrap_or("@"))?; from_tree = workspace_command - .resolve_single_rev(args.from.as_deref().unwrap_or("@"), ui)? + .resolve_single_rev(args.from.as_deref().unwrap_or("@"))? .tree()?; } else { to_commit = - workspace_command.resolve_single_rev(args.changes_in.as_deref().unwrap_or("@"), ui)?; + workspace_command.resolve_single_rev(args.changes_in.as_deref().unwrap_or("@"))?; from_tree = merge_commit_trees(workspace_command.repo().as_ref(), &to_commit.parents())?; } workspace_command.check_rewritable([&to_commit])?; diff --git a/cli/src/commands/run.rs b/cli/src/commands/run.rs index c473b69e27..82f28c5aac 100644 --- a/cli/src/commands/run.rs +++ b/cli/src/commands/run.rs @@ -49,8 +49,7 @@ pub struct RunArgs { pub fn cmd_run(ui: &mut Ui, command: &CommandHelper, args: &RunArgs) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let _resolved_commits = - resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command, ui)?; + let _resolved_commits = resolve_multiple_nonempty_revsets(&args.revisions, &workspace_command)?; // Jobs are resolved in this order: // 1. Commandline argument iff > 0. // 2. the amount of cores available. diff --git a/cli/src/commands/show.rs b/cli/src/commands/show.rs index 4529654ce6..082d8c64f0 100644 --- a/cli/src/commands/show.rs +++ b/cli/src/commands/show.rs @@ -44,7 +44,7 @@ pub(crate) fn cmd_show( args: &ShowArgs, ) -> Result<(), CommandError> { let workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; let template_string = match &args.template { Some(value) => value.to_string(), None => command.settings().config().get_string("templates.show")?, diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index 2f5ff9f786..7b1563a761 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -55,7 +55,7 @@ pub(crate) fn cmd_split( args: &SplitArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&commit])?; let matcher = workspace_command.matcher_from_values(&args.paths)?; let mut tx = workspace_command.start_transaction(); diff --git a/cli/src/commands/squash.rs b/cli/src/commands/squash.rs index c470745fb5..c91624ed8f 100644 --- a/cli/src/commands/squash.rs +++ b/cli/src/commands/squash.rs @@ -54,7 +54,7 @@ pub(crate) fn cmd_squash( args: &SquashArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&commit])?; let parents = commit.parents(); if parents.len() != 1 { diff --git a/cli/src/commands/unsquash.rs b/cli/src/commands/unsquash.rs index fe6d929d5b..113ef3ba8d 100644 --- a/cli/src/commands/unsquash.rs +++ b/cli/src/commands/unsquash.rs @@ -50,7 +50,7 @@ pub(crate) fn cmd_unsquash( args: &UnsquashArgs, ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let commit = workspace_command.resolve_single_rev(&args.revision, ui)?; + let commit = workspace_command.resolve_single_rev(&args.revision)?; workspace_command.check_rewritable([&commit])?; let parents = commit.parents(); if parents.len() != 1 { diff --git a/cli/src/commands/workspace.rs b/cli/src/commands/workspace.rs index 82fd97cc1f..5158ab8241 100644 --- a/cli/src/commands/workspace.rs +++ b/cli/src/commands/workspace.rs @@ -185,7 +185,7 @@ fn cmd_workspace_add( vec![tx.repo().store().root_commit()] } } else { - cli_util::resolve_all_revs(&old_workspace_command, ui, &args.revision)? + cli_util::resolve_all_revs(&old_workspace_command, &args.revision)? .into_iter() .collect_vec() };