Skip to content

Commit

Permalink
cli: migrate trivial uses of op_walk::resolve_op_for_load()
Browse files Browse the repository at this point in the history
Now heads merging can be turned off by --at-op=@.
  • Loading branch information
yuja committed Aug 3, 2024
1 parent 2008991 commit 5bfb374
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
8 changes: 2 additions & 6 deletions cli/src/commands/debug/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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())
Expand Down
6 changes: 1 addition & 5 deletions cli/src/commands/debug/reindex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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)?;
Expand Down

0 comments on commit 5bfb374

Please sign in to comment.