Materialize the working copy for a specific prefix only. This is useful for partial updates when you only want to sync a subset of files. # Arguments `working_copy` - The validated physical working-copy identity `prefix` - Path prefix to materialize (e.g., "src/") # Returns Statistics about the materialize operation.
(
&self,
working_copy: WorkingCopyId,
prefix: &str,
)
| 2407 | /// |
| 2408 | /// Statistics about the materialize operation. |
| 2409 | pub fn materialize_prefix( |
| 2410 | &self, |
| 2411 | working_copy: WorkingCopyId, |
| 2412 | prefix: &str, |
| 2413 | ) -> Result<MaterializeResult, RepositoryError> { |
| 2414 | self.validate_working_copy(working_copy)?; |
| 2415 | let view_name = self.desired_view_name(working_copy)?; |
| 2416 | let txn = self |
| 2417 | .pristine |
| 2418 | .read_txn() |
| 2419 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 2420 | let view = txn |
| 2421 | .get_view(&view_name) |
| 2422 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 2423 | .ok_or_else(|| RepositoryError::ViewNotFound { |
| 2424 | name: view_name.clone(), |
| 2425 | })?; |
| 2426 | let visibility = graph_visibility_closure(&txn, &view)?; |
| 2427 | let projection = self.project_tree_for_visibility(&txn, &visibility)?; |
| 2428 | let mut paths: HashSet<String> = projection |
| 2429 | .present |
| 2430 | .keys() |
| 2431 | .chain(projection.absent_metadata.keys()) |
| 2432 | .chain(projection.name_conflicts.keys()) |
| 2433 | .filter(|path| path.starts_with(prefix)) |
| 2434 | .cloned() |
| 2435 | .collect(); |
| 2436 | for path in projection.present.keys() { |
| 2437 | if prefix |
| 2438 | .strip_prefix(path) |
| 2439 | .is_some_and(|suffix| suffix.starts_with('/')) |
| 2440 | { |
| 2441 | paths.insert(path.clone()); |
| 2442 | } |
| 2443 | } |
| 2444 | drop(txn); |
| 2445 | self.materialize_parallel(working_copy, Some(paths)) |
| 2446 | } |
| 2447 | } |
| 2448 | |
| 2449 | /// One entry of a view's tree, rendered in memory by |
nothing calls this directly
no test coverage detected