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

Source from the content-addressed store, hash-verified

889}
890
891fn format_hunk_aggregate_info(
892 total: usize,
893 infos: &std::collections::BTreeMap<String, usize>,
894) -> String {
895 if total == 1 {
896 return infos
897 .keys()
898 .next()
899 .cloned()
900 .unwrap_or_else(|| "(1 hunk)".to_string());
901 }
902
903 let details = infos
904 .iter()
905 .map(|(info, count)| format!("{}x {}", count, trim_hunk_info(info)))
906 .collect::<Vec<_>>()
907 .join("; ");
908 format!("({} hunks: {})", total, details)
909}
910
911fn trim_hunk_info(info: &str) -> &str {
912 info.strip_prefix('(')

Callers 1

hunk_display_summariesFunction · 0.85

Calls 2

nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected