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

Source from the content-addressed store, hash-verified

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

Callers 1

hunk_display_summariesFunction · 0.85

Calls 2

nextMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected