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:949–967  ·  view source on GitHub ↗
(
    total: usize,
    infos: &std::collections::BTreeMap<String, usize>,
)

Source from the content-addressed store, hash-verified

947}
948
949fn format_hunk_aggregate_info(
950 total: usize,
951 infos: &std::collections::BTreeMap<String, usize>,
952) -> String {
953 if total == 1 {
954 return infos
955 .keys()
956 .next()
957 .cloned()
958 .unwrap_or_else(|| "(1 hunk)".to_string());
959 }
960
961 let details = infos
962 .iter()
963 .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info)))
964 .collect::<Vec<_>>()
965 .join("; ");
966 format!("({} hunks: {})", total, details)
967}
968
969fn trim_hunk_info(info: &str) -> &str {
970 info.strip_prefix('(')

Callers 1

hunk_display_summariesFunction · 0.85

Calls 2

nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected