mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-28 09:14:04 +00:00
repo: remove last mutating method from ReadonlyRepo
`ReadonlyRepo::reindex()` is only used in `jj debug reindex`, and it can be implemented by creating a new instance instead of mutating `ReadonlyRepo`.
This commit is contained in:
parent
cf3b6ee2c9
commit
a27da7d8d5
3 changed files with 8 additions and 14 deletions
|
@ -206,12 +206,6 @@ impl ReadonlyRepo {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn reindex(&mut self) -> &Arc<ReadonlyIndex> {
|
||||
self.index_store.reinit();
|
||||
self.index.take();
|
||||
self.index()
|
||||
}
|
||||
|
||||
pub fn store(&self) -> &Arc<Store> {
|
||||
&self.store
|
||||
}
|
||||
|
|
|
@ -465,10 +465,6 @@ impl WorkspaceCommandHelper {
|
|||
&self.repo
|
||||
}
|
||||
|
||||
pub fn repo_mut(&mut self) -> &mut Arc<ReadonlyRepo> {
|
||||
&mut self.repo
|
||||
}
|
||||
|
||||
pub fn working_copy(&self) -> &WorkingCopy {
|
||||
self.workspace.working_copy()
|
||||
}
|
||||
|
|
|
@ -3519,10 +3519,14 @@ fn cmd_debug(
|
|||
}
|
||||
}
|
||||
DebugCommands::ReIndex(_reindex_matches) => {
|
||||
let mut workspace_command = command.workspace_helper(ui)?;
|
||||
let mut_repo = Arc::get_mut(workspace_command.repo_mut()).unwrap();
|
||||
let index = mut_repo.reindex();
|
||||
writeln!(ui, "Finished indexing {:?} commits.", index.num_commits())?;
|
||||
let workspace_command = command.workspace_helper(ui)?;
|
||||
let repo = workspace_command.repo();
|
||||
let repo = repo.reload_at(repo.operation());
|
||||
writeln!(
|
||||
ui,
|
||||
"Finished indexing {:?} commits.",
|
||||
repo.index().num_commits()
|
||||
)?;
|
||||
}
|
||||
DebugCommands::Operation(operation_args) => {
|
||||
let workspace_command = command.workspace_helper(ui)?;
|
||||
|
|
Loading…
Reference in a new issue