(parsed: &ParsedCommit, line_index: &ImportLineIndex)
| 822 | } |
| 823 | |
| 824 | fn import_shape_summary(parsed: &ParsedCommit, line_index: &ImportLineIndex) -> String { |
| 825 | let mut entries: Vec<(usize, String)> = parsed |
| 826 | .files |
| 827 | .iter() |
| 828 | .map(|file| { |
| 829 | let (current_lines, indexed_lines, imported_commits) = |
| 830 | import_shape_for_file(file, line_index); |
| 831 | let bytes = file |
| 832 | .new_content |
| 833 | .as_ref() |
| 834 | .or(file.old_content.as_ref()) |
| 835 | .map(|content| content.len()) |
| 836 | .unwrap_or(0); |
| 837 | let weight = current_lines |
| 838 | .saturating_mul(imported_commits.max(1)) |
| 839 | .saturating_add(indexed_lines); |
| 840 | ( |
| 841 | weight, |
| 842 | format!( |
| 843 | "{} op={:?} lines={} indexed_lines={} file_commits={} bytes={}", |
| 844 | file.path, |
| 845 | file.operation, |
| 846 | current_lines, |
| 847 | indexed_lines, |
| 848 | imported_commits, |
| 849 | bytes |
| 850 | ), |
| 851 | ) |
| 852 | }) |
| 853 | .collect(); |
| 854 | entries.sort_by_key(|entry| std::cmp::Reverse(entry.0)); |
| 855 | entries |
| 856 | .into_iter() |
| 857 | .take(3) |
| 858 | .map(|(_, entry)| entry) |
| 859 | .collect::<Vec<_>>() |
| 860 | .join("; ") |
| 861 | } |
| 862 | |
| 863 | fn graph_first_skip_summary(skips: &[GraphFirstSkip], parsed: &ParsedCommit) -> String { |
| 864 | if skips.is_empty() { |
no test coverage detected