mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-24 12:48:55 +00:00
op_heads_store: don't pass whole RepoLoader
into get_heads()
We only need to be able to read operations, so it's better to pass in just an `OpStore`.
This commit is contained in:
parent
21d8c501e3
commit
601638c422
2 changed files with 2 additions and 5 deletions
|
@ -23,7 +23,6 @@ use crate::backend::Timestamp;
|
|||
use crate::lock::FileLock;
|
||||
use crate::op_store::{OpStore, OperationId, OperationMetadata};
|
||||
use crate::operation::Operation;
|
||||
use crate::repo::RepoLoader;
|
||||
use crate::{dag_walk, op_store};
|
||||
|
||||
/// Manages the very set of current heads of the operation log. The store is
|
||||
|
@ -124,7 +123,7 @@ impl OpHeadsStore {
|
|||
|
||||
pub fn get_heads(
|
||||
self: &Arc<Self>,
|
||||
repo_loader: &RepoLoader,
|
||||
op_store: &Arc<dyn OpStore>,
|
||||
) -> Result<OpHeads, OpHeadResolutionError> {
|
||||
let mut op_heads = self.get_op_heads();
|
||||
|
||||
|
@ -132,8 +131,6 @@ impl OpHeadsStore {
|
|||
return Err(OpHeadResolutionError::NoHeads);
|
||||
}
|
||||
|
||||
let op_store = repo_loader.op_store();
|
||||
|
||||
if op_heads.len() == 1 {
|
||||
let operation_id = op_heads.pop().unwrap();
|
||||
let operation = op_store.read_operation(&operation_id).unwrap();
|
||||
|
|
|
@ -373,7 +373,7 @@ impl RepoLoader {
|
|||
}
|
||||
|
||||
pub fn load_at_head(&self) -> RepoAtHead {
|
||||
let op_heads = self.op_heads_store.get_heads(self).unwrap();
|
||||
let op_heads = self.op_heads_store.get_heads(&self.op_store).unwrap();
|
||||
match op_heads {
|
||||
OpHeads::Single(op) => {
|
||||
let view = View::new(op.view().take_store_view());
|
||||
|
|
Loading…
Reference in a new issue