From 5bfb3742e85ec637354772463140c3a93daccb78 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Tue, 23 Jul 2024 22:43:30 +0900 Subject: [PATCH] cli: migrate trivial uses of op_walk::resolve_op_for_load() Now heads merging can be turned off by --at-op=@. --- cli/src/commands/debug/index.rs | 8 ++------ cli/src/commands/debug/reindex.rs | 6 +----- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/cli/src/commands/debug/index.rs b/cli/src/commands/debug/index.rs index c626dc4df..8793fceed 100644 --- a/cli/src/commands/debug/index.rs +++ b/cli/src/commands/debug/index.rs @@ -16,7 +16,6 @@ use std::fmt::Debug; use std::io::Write as _; use jj_lib::default_index::{AsCompositeIndex as _, DefaultReadonlyIndex}; -use jj_lib::op_walk; use crate::cli_util::CommandHelper; use crate::command_error::{internal_error, user_error, CommandError}; @@ -32,13 +31,10 @@ pub fn cmd_debug_index( _args: &DebugIndexArgs, ) -> Result<(), CommandError> { // Resolve the operation without loading the repo, so this command won't - // merge concurrent operations and update the index. + // update the index. let workspace = command.load_workspace()?; let repo_loader = workspace.repo_loader(); - let op = op_walk::resolve_op_for_load( - repo_loader, - command.global_args().at_operation.as_deref().unwrap_or("@"), - )?; + let op = command.resolve_operation(ui, repo_loader)?; let index_store = repo_loader.index_store(); let index = index_store .get_index_at_op(&op, repo_loader.store()) diff --git a/cli/src/commands/debug/reindex.rs b/cli/src/commands/debug/reindex.rs index 0e37e7b52..b8b2fa7f1 100644 --- a/cli/src/commands/debug/reindex.rs +++ b/cli/src/commands/debug/reindex.rs @@ -16,7 +16,6 @@ use std::fmt::Debug; use std::io::Write as _; use jj_lib::default_index::{AsCompositeIndex as _, DefaultIndexStore}; -use jj_lib::op_walk; use crate::cli_util::CommandHelper; use crate::command_error::{internal_error, user_error, CommandError}; @@ -35,10 +34,7 @@ pub fn cmd_debug_reindex( // be rebuilt while loading the repo. let workspace = command.load_workspace()?; let repo_loader = workspace.repo_loader(); - let op = op_walk::resolve_op_for_load( - repo_loader, - command.global_args().at_operation.as_deref().unwrap_or("@"), - )?; + let op = command.resolve_operation(ui, repo_loader)?; let index_store = repo_loader.index_store(); if let Some(default_index_store) = index_store.as_any().downcast_ref::() { default_index_store.reinit().map_err(internal_error)?;