MCPcopy Create free account
hub / github.com/Mic92/nix-diff-rs / format_inputs_diff

Method format_inputs_diff

src/render.rs:368–447  ·  view source on GitHub ↗
(
        &self,
        output: &mut Vec<u8>,
        diff: &InputsDiff,
        indent: usize,
        depth: usize,
    )

Source from the content-addressed store, hash-verified

366 }
367
368 fn format_inputs_diff(
369 &self,
370 output: &mut Vec<u8>,
371 diff: &InputsDiff,
372 indent: usize,
373 depth: usize,
374 ) {
375 let InputsDiff {
376 added,
377 removed,
378 changed,
379 } = diff;
380
381 // Only show section header if there are simple additions/removals
382 if !added.is_empty() || !removed.is_empty() {
383 self.write_section(output, b"Input derivations", indent);
384 self.write_path_list(
385 output,
386 removed.iter().map(|p| &p.0),
387 b"- ",
388 self.red(),
389 indent + 2,
390 );
391 self.write_path_list(
392 output,
393 added.iter().map(|p| &p.0),
394 b"+ ",
395 self.green(),
396 indent + 2,
397 );
398 }
399
400 // Show changed derivations with a compact • bullet header.
401 for inp_diff in changed {
402 let already = matches!(
403 inp_diff.derivation.as_deref(),
404 Some(DerivationDiff {
405 outputs: OutputsDiff::AlreadyCompared,
406 ..
407 })
408 );
409 self.write_indent(output, indent);
410 extend!(
411 output,
412 self.bold(),
413 self.cyan(),
414 b"\xe2\x80\xa2 ",
415 &inp_diff.path,
416 self.reset()
417 );
418 if already {
419 extend!(output, self.dim(), b" (already compared)", self.reset());
420 }
421 output.push(b'\n');
422
423 // Consumed-output changes are independent of the nested derivation
424 // diff: they describe which outputs the *parent* consumes from this
425 // input. Show them regardless of whether we also have a drv diff.

Calls 7

write_sectionMethod · 0.80
write_path_listMethod · 0.80
redMethod · 0.80
greenMethod · 0.80
write_indentMethod · 0.80