first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
@@ -9,6 +9,7 @@ use repo_metadata::file_tree_update::{
DirectoryNodeMetadata, FileNodeMetadata, FileTreeEntryUpdate, RepoMetadataUpdate,
RepoNodeMetadata,
};
use repo_metadata::{StandingQueryContent, StandingQueryResultsDelta};
use crate::proto;
@@ -28,6 +29,47 @@ impl From<&RepoMetadataUpdate> for proto::RepoMetadataUpdatePush {
.iter()
.map(proto::RepoMetadataEntryUpdate::from)
.collect(),
standing_results_delta: Some((&update.standing_results_delta).into()),
}
}
}
#[cfg(test)]
#[path = "repo_metadata_proto_tests.rs"]
mod tests;
impl From<&StandingQueryContent> for proto::StandingQueryContent {
fn from(content: &StandingQueryContent) -> Self {
Self {
path: content.path.to_string(),
is_directory: content.is_directory,
}
}
}
impl From<&StandingQueryResultsDelta> for proto::StandingQueryResultsDelta {
fn from(delta: &StandingQueryResultsDelta) -> Self {
Self {
upserted_project_skills: delta
.upserted_project_skills
.iter()
.map(proto::StandingQueryContent::from)
.collect(),
removed_project_skills: delta
.removed_project_skills
.iter()
.map(proto::StandingQueryContent::from)
.collect(),
upserted_project_rules: delta
.upserted_project_rules
.iter()
.map(proto::StandingQueryContent::from)
.collect(),
removed_project_rules: delta
.removed_project_rules
.iter()
.map(proto::StandingQueryContent::from)
.collect(),
}
}
}
@@ -159,9 +201,50 @@ pub fn proto_to_repo_metadata_update(
repo_path,
remove_entries,
update_entries,
standing_results_delta: push
.standing_results_delta
.as_ref()
.map(proto_to_standing_results_delta)
.unwrap_or_default(),
})
}
fn proto_to_standing_query_content(
content: &proto::StandingQueryContent,
) -> Option<StandingQueryContent> {
Some(StandingQueryContent {
path: StandardizedPath::try_new(&content.path).ok()?,
is_directory: content.is_directory,
})
}
fn proto_to_standing_results_delta(
delta: &proto::StandingQueryResultsDelta,
) -> StandingQueryResultsDelta {
StandingQueryResultsDelta {
upserted_project_skills: delta
.upserted_project_skills
.iter()
.filter_map(proto_to_standing_query_content)
.collect(),
removed_project_skills: delta
.removed_project_skills
.iter()
.filter_map(proto_to_standing_query_content)
.collect(),
upserted_project_rules: delta
.upserted_project_rules
.iter()
.filter_map(proto_to_standing_query_content)
.collect(),
removed_project_rules: delta
.removed_project_rules
.iter()
.filter_map(proto_to_standing_query_content)
.collect(),
}
}
/// Converts a `RepoMetadataSnapshot` proto into a `RepoMetadataUpdate`
/// (with no removals) that can be applied to a `RemoteRepoMetadataModel`.
pub fn proto_snapshot_to_update(
@@ -179,6 +262,11 @@ pub fn proto_snapshot_to_update(
repo_path,
remove_entries: Vec::new(),
update_entries,
standing_results_delta: snapshot
.standing_results
.as_ref()
.map(proto_to_standing_results_delta)
.unwrap_or_default(),
})
}
@@ -216,6 +304,7 @@ pub fn proto_load_repo_metadata_directory_response_to_update(
repo_path,
remove_entries: Vec::new(),
update_entries,
standing_results_delta: StandingQueryResultsDelta::default(),
})
}