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

Function format_hunk_aggregate_info

atomic-cli/src/commands/change/command.rs:909–927  ·  view source on GitHub ↗
(
    total: usize,
    infos: &std::collections::BTreeMap<String, usize>,
)

Source from the content-addressed store, hash-verified

907}
908
909fn format_hunk_aggregate_info(
910 total: usize,
911 infos: &std::collections::BTreeMap<String, usize>,
912) -> String {
913 if total == 1 {
914 return infos
915 .keys()
916 .next()
917 .cloned()
918 .unwrap_or_else(|| "(1 hunk)".to_string());
919 }
920
921 let details = infos
922 .iter()
923 .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info)))
924 .collect::<Vec<_>>()
925 .join("; ");
926 format!("({} hunks: {})", total, details)
927}
928
929fn trim_hunk_info(info: &str) -> &str {
930 info.strip_prefix('(')

Callers 1

hunk_display_summariesFunction · 0.85

Calls 2

nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected