diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index d48f8ad975..9ed7e49a0d 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -799,14 +799,6 @@ impl WorkspaceCommandHelper { } } - /// Resolve a revset any number of revisions (including 0). - pub fn resolve_revset(&self, revision_str: &str) -> Result, CommandError> { - Ok(self - .parse_revset(revision_str)? - .evaluate_to_commits()? - .try_collect()?) - } - pub fn parse_revset( &self, revision_str: &str, diff --git a/cli/src/commands/squash.rs b/cli/src/commands/squash.rs index eb0883b8c8..484116498d 100644 --- a/cli/src/commands/squash.rs +++ b/cli/src/commands/squash.rs @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +use itertools::Itertools as _; use jj_lib::commit::Commit; use jj_lib::matchers::Matcher; use jj_lib::object_id::ObjectId; @@ -80,10 +81,13 @@ pub(crate) fn cmd_squash( ) -> Result<(), CommandError> { let mut workspace_command = command.workspace_helper(ui)?; - let mut sources; + let mut sources: Vec; let destination; if args.from.is_some() || args.into.is_some() { - sources = workspace_command.resolve_revset(args.from.as_deref().unwrap_or("@"))?; + sources = workspace_command + .parse_revset(args.from.as_deref().unwrap_or("@"))? + .evaluate_to_commits()? + .try_collect()?; destination = workspace_command.resolve_single_rev(args.into.as_deref().unwrap_or("@"))?; if sources.iter().any(|source| source.id() == destination.id()) { return Err(user_error("Source and destination cannot be the same"));