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

Source from the content-addressed store, hash-verified

924}
925
926fn format_hunk_aggregate_info(
927 total: usize,
928 infos: &std::collections::BTreeMap<String, usize>,
929) -> String {
930 if total == 1 {
931 return infos
932 .keys()
933 .next()
934 .cloned()
935 .unwrap_or_else(|| "(1 hunk)".to_string());
936 }
937
938 let details = infos
939 .iter()
940 .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info)))
941 .collect::<Vec<_>>()
942 .join("; ");
943 format!("({} hunks: {})", total, details)
944}
945
946fn trim_hunk_info(info: &str) -> &str {
947 info.strip_prefix('(')

Callers 1

hunk_display_summariesFunction · 0.85

Calls 2

nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected