diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index f3b9016f4..3daaf3395 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -771,7 +771,19 @@ impl WorkspaceCommandHelper { ) -> Result, CommandError> { let mut all_commits = IndexSet::new(); for revision_str in revision_args { - let commits = self.resolve_revset_default_single(revision_str)?; + let (expression, all) = self.parse_revset_with_all_prefix(revision_str)?; + let commits = if all { + expression.evaluate_to_commits()?.try_collect()? + } else { + let should_hint_about_all_prefix = true; + let commit = revset_util::evaluate_revset_to_single_commit( + revision_str, + &expression, + || self.commit_summary_template(), + should_hint_about_all_prefix, + )?; + vec![commit] + }; for commit in commits { let commit_hash = short_commit_hash(commit.id()); if !all_commits.insert(commit) { @@ -796,28 +808,6 @@ impl WorkspaceCommandHelper { .try_collect()?) } - /// Resolve a revset any number of revisions (including 0), but require the - /// user to indicate if they allow multiple revisions by prefixing the - /// expression with `all:`. - fn resolve_revset_default_single( - &self, - revision_str: &str, - ) -> Result, CommandError> { - let (expression, all) = self.parse_revset_with_all_prefix(revision_str)?; - if all { - Ok(expression.evaluate_to_commits()?.try_collect()?) - } else { - let should_hint_about_all_prefix = true; - let commit = revset_util::evaluate_revset_to_single_commit( - revision_str, - &expression, - || self.commit_summary_template(), - should_hint_about_all_prefix, - )?; - Ok(vec![commit]) - } - } - pub fn parse_revset( &self, revision_str: &str,