index: move current implementation to default_index_store.rs

The idea is that `index.rs` contains the interface, similar to
`backend.rs` for commits, and `op_store.rs` for operations.
This commit is contained in:
Martin von Zweigbergk 2023-02-28 21:50:04 -08:00 committed by Martin von Zweigbergk
parent 8fc2062a38
commit e5ba9d9e42
9 changed files with 2392 additions and 2389 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,7 +17,7 @@ use std::sync::Arc;
use thiserror::Error;
use crate::index::{MutableIndex, ReadonlyIndex};
use crate::default_index_store::{MutableIndex, ReadonlyIndex};
use crate::op_store::OperationId;
use crate::operation::Operation;
use crate::store::Store;

View file

@ -22,7 +22,7 @@ pub mod commit;
pub mod commit_builder;
pub mod conflicts;
pub mod dag_walk;
mod default_index_store;
pub mod default_index_store;
pub mod diff;
pub mod file_util;
pub mod files;

View file

@ -28,11 +28,11 @@ use crate::backend::{Backend, BackendError, BackendResult, ChangeId, CommitId, O
use crate::commit::Commit;
use crate::commit_builder::CommitBuilder;
use crate::dag_walk::topo_order_reverse;
use crate::default_index_store::DefaultIndexStore;
use crate::git_backend::GitBackend;
use crate::index::{
HexPrefix, Index, IndexEntry, IndexPosition, MutableIndex, PrefixResolution, ReadonlyIndex,
use crate::default_index_store::{
DefaultIndexStore, IndexEntry, IndexPosition, MutableIndex, ReadonlyIndex,
};
use crate::git_backend::GitBackend;
use crate::index::{HexPrefix, Index, PrefixResolution};
use crate::index_store::IndexStore;
use crate::local_backend::LocalBackend;
use crate::op_heads_store::{self, OpHeadResolutionError, OpHeadsStore};

View file

@ -31,8 +31,9 @@ use thiserror::Error;
use crate::backend::{BackendError, BackendResult, CommitId, ObjectId};
use crate::commit::Commit;
use crate::default_index_store::IndexEntry;
use crate::hex_util::to_forward_hex;
use crate::index::{HexPrefix, IndexEntry, PrefixResolution};
use crate::index::{HexPrefix, PrefixResolution};
use crate::matchers::{EverythingMatcher, Matcher, PrefixMatcher};
use crate::op_store::WorkspaceId;
use crate::repo::Repo;
@ -2223,7 +2224,8 @@ fn has_diff_from_parent(repo: &dyn Repo, entry: &IndexEntry<'_>, matcher: &dyn M
mod tests {
use super::*;
use crate::backend::ChangeId;
use crate::index::{Index, MutableIndex};
use crate::default_index_store::MutableIndex;
use crate::index::Index;
/// Generator of unique 16-byte ChangeId excluding root id
fn change_id_generator() -> impl FnMut() -> ChangeId {

View file

@ -15,7 +15,7 @@
use std::cmp::min;
use std::collections::{BTreeMap, HashMap, HashSet};
use crate::index::{IndexEntry, IndexPosition};
use crate::default_index_store::{IndexEntry, IndexPosition};
use crate::nightly_shims::BTreeMapExt;
use crate::revset::Revset;

View file

@ -16,7 +16,7 @@ use std::sync::Arc;
use crate::backend::Timestamp;
use crate::dag_walk::closest_common_node;
use crate::index::ReadonlyIndex;
use crate::default_index_store::ReadonlyIndex;
use crate::op_store;
use crate::op_store::OperationMetadata;
use crate::operation::Operation;

View file

@ -30,7 +30,8 @@ use itertools::Itertools;
use jujutsu_lib::backend::{CommitId, ObjectId, TreeValue};
use jujutsu_lib::commit::Commit;
use jujutsu_lib::dag_walk::topo_order_reverse;
use jujutsu_lib::index::{Index, IndexEntry};
use jujutsu_lib::default_index_store::IndexEntry;
use jujutsu_lib::index::Index;
use jujutsu_lib::matchers::EverythingMatcher;
use jujutsu_lib::op_store::{RefTarget, WorkspaceId};
use jujutsu_lib::repo::{ReadonlyRepo, Repo};