mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-06 05:04:18 +00:00
index_store: add more scope to write_index()
This is more consistent with the other method and it makes some extension operations easier, by giving access to the OpStore and other relevant context for custom index extensions.
This commit is contained in:
parent
3307696ba8
commit
3a0929b876
3 changed files with 4 additions and 5 deletions
|
@ -359,14 +359,14 @@ impl IndexStore for DefaultIndexStore {
|
|||
fn write_index(
|
||||
&self,
|
||||
index: Box<dyn MutableIndex>,
|
||||
op_id: &OperationId,
|
||||
op: &Operation,
|
||||
) -> Result<Box<dyn ReadonlyIndex>, IndexWriteError> {
|
||||
let index = index
|
||||
.into_any()
|
||||
.downcast::<DefaultMutableIndex>()
|
||||
.expect("index to merge in must be a DefaultMutableIndex");
|
||||
let index_segment = self
|
||||
.save_mutable_index(*index, op_id)
|
||||
.save_mutable_index(*index, op.id())
|
||||
.map_err(|err| IndexWriteError(err.into()))?;
|
||||
Ok(Box::new(DefaultReadonlyIndex::from_segment(index_segment)))
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ use thiserror::Error;
|
|||
use crate::backend::{ChangeId, CommitId};
|
||||
use crate::commit::Commit;
|
||||
use crate::object_id::{HexPrefix, PrefixResolution};
|
||||
use crate::op_store::OperationId;
|
||||
use crate::operation::Operation;
|
||||
use crate::revset::{ResolvedExpression, Revset, RevsetEvaluationError};
|
||||
use crate::store::Store;
|
||||
|
@ -67,7 +66,7 @@ pub trait IndexStore: Send + Sync + Debug {
|
|||
fn write_index(
|
||||
&self,
|
||||
index: Box<dyn MutableIndex>,
|
||||
op_id: &OperationId,
|
||||
op: &Operation,
|
||||
) -> Result<Box<dyn ReadonlyIndex>, IndexWriteError>;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ impl Transaction {
|
|||
|
||||
let index = base_repo
|
||||
.index_store()
|
||||
.write_index(mut_index, operation.id())
|
||||
.write_index(mut_index, &operation)
|
||||
.unwrap();
|
||||
UnpublishedOperation::new(&base_repo.loader(), operation, view, index)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue