(
&mut self,
name: &[u8],
path1: &[u8],
path2: &[u8],
outputs1: &BTreeSet<Vec<u8>>,
outputs2: &BTreeSet<Vec<u8>>,
changed: &mut Vec<InputDiff>,
| 342 | } |
| 343 | |
| 344 | fn push_changed_input( |
| 345 | &mut self, |
| 346 | name: &[u8], |
| 347 | path1: &[u8], |
| 348 | path2: &[u8], |
| 349 | outputs1: &BTreeSet<Vec<u8>>, |
| 350 | outputs2: &BTreeSet<Vec<u8>>, |
| 351 | changed: &mut Vec<InputDiff>, |
| 352 | ) -> Result<()> { |
| 353 | let outputs_diff = if outputs1 != outputs2 { |
| 354 | let added_outputs: BTreeSet<_> = outputs2.difference(outputs1).cloned().collect(); |
| 355 | let removed_outputs: BTreeSet<_> = outputs1.difference(outputs2).cloned().collect(); |
| 356 | if !added_outputs.is_empty() || !removed_outputs.is_empty() { |
| 357 | Some(OutputSetDiff { |
| 358 | added: added_outputs, |
| 359 | removed: removed_outputs, |
| 360 | }) |
| 361 | } else { |
| 362 | None |
| 363 | } |
| 364 | } else { |
| 365 | None |
| 366 | }; |
| 367 | |
| 368 | // Try to load and recursively diff the derivations |
| 369 | let derivation_diff = |
| 370 | if let (Ok(p1), Ok(p2)) = (std::str::from_utf8(path1), std::str::from_utf8(path2)) { |
| 371 | if let (Ok(drv1), Ok(drv2)) = ( |
| 372 | crate::parser::parse_derivation(p1), |
| 373 | crate::parser::parse_derivation(p2), |
| 374 | ) { |
| 375 | Some(Box::new(self.diff_derivations(path1, path2, &drv1, &drv2)?)) |
| 376 | } else { |
| 377 | None |
| 378 | } |
| 379 | } else { |
| 380 | None |
| 381 | }; |
| 382 | |
| 383 | changed.push(InputDiff { |
| 384 | path: name.to_vec(), |
| 385 | outputs: outputs_diff, |
| 386 | derivation: derivation_diff, |
| 387 | }); |
| 388 | Ok(()) |
| 389 | } |
| 390 | |
| 391 | fn diff_environment( |
| 392 | &self, |
no test coverage detected