mirror of
https://github.com/martinvonz/jj.git
synced 2024-11-10 14:16:24 +03: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
@ -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> {
|
pub fn store(&self) -> &Arc<Store> {
|
||||||
&self.store
|
&self.store
|
||||||
}
|
}
|
||||||
|
@ -465,10 +465,6 @@ impl WorkspaceCommandHelper {
|
|||||||
&self.repo
|
&self.repo
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn repo_mut(&mut self) -> &mut Arc<ReadonlyRepo> {
|
|
||||||
&mut self.repo
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn working_copy(&self) -> &WorkingCopy {
|
pub fn working_copy(&self) -> &WorkingCopy {
|
||||||
self.workspace.working_copy()
|
self.workspace.working_copy()
|
||||||
}
|
}
|
||||||
|
@ -3519,10 +3519,14 @@ fn cmd_debug(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DebugCommands::ReIndex(_reindex_matches) => {
|
DebugCommands::ReIndex(_reindex_matches) => {
|
||||||
let mut workspace_command = command.workspace_helper(ui)?;
|
let workspace_command = command.workspace_helper(ui)?;
|
||||||
let mut_repo = Arc::get_mut(workspace_command.repo_mut()).unwrap();
|
let repo = workspace_command.repo();
|
||||||
let index = mut_repo.reindex();
|
let repo = repo.reload_at(repo.operation());
|
||||||
writeln!(ui, "Finished indexing {:?} commits.", index.num_commits())?;
|
writeln!(
|
||||||
|
ui,
|
||||||
|
"Finished indexing {:?} commits.",
|
||||||
|
repo.index().num_commits()
|
||||||
|
)?;
|
||||||
}
|
}
|
||||||
DebugCommands::Operation(operation_args) => {
|
DebugCommands::Operation(operation_args) => {
|
||||||
let workspace_command = command.workspace_helper(ui)?;
|
let workspace_command = command.workspace_helper(ui)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user