MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / print_change_file_diffs

Method print_change_file_diffs

atomic-cli/src/commands/diff/helpers.rs:464–490  ·  view source on GitHub ↗

Render a recorded change's computed file diffs — the header for the human unified form, then the configured format. Shared by the local `-c` body and the service-layer hook (one render, two data sources: the file diffs arrive from the graph or the wire).

(
        &self,
        change: &Change,
        change_hash: &Hash,
        config: &DiffOutputConfig,
        file_diffs: Vec<FileDiff>,
        stats: DiffStats,
    )

Source from the content-addressed store, hash-verified

462 /// `-c` body and the service-layer hook (one render, two data sources:
463 /// the file diffs arrive from the graph or the wire).
464 pub(crate) fn print_change_file_diffs(
465 &self,
466 change: &Change,
467 change_hash: &Hash,
468 config: &DiffOutputConfig,
469 file_diffs: Vec<FileDiff>,
470 stats: DiffStats,
471 ) -> CliResult<()> {
472 if file_diffs.is_empty() {
473 self.print_no_changes();
474 return Ok(());
475 }
476
477 // The human header duplicates what `--json` already carries under
478 // `change`, so skip it there.
479 if !self.json && config.format == DiffFormat::Unified {
480 self.print_change_header(change, change_hash, config);
481 }
482
483 self.render(
484 &file_diffs,
485 &stats,
486 config,
487 Some((change, change_hash)),
488 None,
489 )
490 }
491
492 /// Reconstruct a line's text content from its leaf operations.
493 pub(super) fn reconstruct_line_from_leaf_ops(leaf_ops: &[LeafOp]) -> String {

Callers 3

diff_changeFunction · 0.80
show_change_diffMethod · 0.80

Calls 4

print_no_changesMethod · 0.80
print_change_headerMethod · 0.80
is_emptyMethod · 0.45
renderMethod · 0.45

Tested by

no test coverage detected