| 2672 | } |
| 2673 | |
| 2674 | fn import_shape_summary(parsed: &ParsedCommit, line_index: &ImportLineIndex) -> String { |
| 2675 | let mut entries: Vec<(usize, String)> = parsed |
| 2676 | .files |
| 2677 | .iter() |
| 2678 | .map(|file| { |
| 2679 | let (current_lines, indexed_lines, imported_commits) = |
| 2680 | import_shape_for_file(file, line_index); |
| 2681 | let bytes = file |
| 2682 | .new_content |
| 2683 | .as_ref() |
| 2684 | .or(file.old_content.as_ref()) |
| 2685 | .map(|content| content.len()) |
| 2686 | .unwrap_or(0); |
| 2687 | let weight = current_lines |
| 2688 | .saturating_mul(imported_commits.max(1)) |
| 2689 | .saturating_add(indexed_lines); |
| 2690 | ( |
| 2691 | weight, |
| 2692 | format!( |
| 2693 | "{} op={:?} lines={} indexed_lines={} file_commits={} bytes={}", |
| 2694 | file.path, |
| 2695 | file.operation, |
| 2696 | current_lines, |
| 2697 | indexed_lines, |
| 2698 | imported_commits, |
| 2699 | bytes |
| 2700 | ), |
| 2701 | ) |
| 2702 | }) |
| 2703 | .collect(); |
| 2704 | entries.sort_by_key(|entry| std::cmp::Reverse(entry.0)); |
| 2705 | entries |
| 2706 | .into_iter() |
| 2707 | .take(3) |
| 2708 | .map(|(_, entry)| entry) |
| 2709 | .collect::<Vec<_>>() |
| 2710 | .join("; ") |
| 2711 | } |
| 2712 | |
| 2713 | fn graph_first_skip_summary(skips: &[GraphFirstSkip], parsed: &ParsedCommit) -> String { |
| 2714 | if skips.is_empty() { |