Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

index_store: add more scope to write_index() #3652

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/src/default_index/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
Expand Down
3 changes: 1 addition & 2 deletions lib/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down