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

cli: migrate trivial uses of op_walk::resolve_op_for_load()

Now heads merging can be turned off by --at-op=@.
This commit is contained in:
Yuya Nishihara 2024-07-23 22:43:30 +09:00
parent 2008991749
commit 5bfb3742e8
2 changed files with 3 additions and 11 deletions

View file

@ -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())

View file

@ -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::<DefaultIndexStore>() {
default_index_store.reinit().map_err(internal_error)?;