Resolve a span change's authored semantic IDs under a receiving transaction. The hashed change is never modified. Legacy V1 operations with external IDs cannot be localized because their owner hashes were not recorded.
(
txn: &T,
change: &crate::change::Change,
)
| 235 | /// The hashed change is never modified. Legacy V1 operations with external |
| 236 | /// IDs cannot be localized because their owner hashes were not recorded. |
| 237 | pub fn localize_file_ops<T: crate::pristine::GraphTxnT>( |
| 238 | txn: &T, |
| 239 | change: &crate::change::Change, |
| 240 | ) -> anyhow::Result<Vec<crate::change::FileOps>> { |
| 241 | let Some(patch) = &change.hashed.span else { |
| 242 | return Ok(change.file_ops().to_vec()); |
| 243 | }; |
| 244 | patch.validate_content_ranges(change.contents.len().try_into()?)?; |
| 245 | Ok( |
| 246 | SemanticNameFrame::new(patch.semantic_owners.clone())?.localize( |
| 247 | txn, |
| 248 | change.dependencies(), |
| 249 | change.file_ops(), |
| 250 | )?, |
| 251 | ) |
| 252 | } |
| 253 | |
| 254 | #[cfg(test)] |
| 255 | mod tests { |
no test coverage detected