(file: &ParsedFile, line_index: &ImportLineIndex)
| 691 | } |
| 692 | |
| 693 | fn import_shape_for_file(file: &ParsedFile, line_index: &ImportLineIndex) -> (usize, usize, usize) { |
| 694 | let indexed = line_index.files.get(&file.path).or_else(|| { |
| 695 | file.old_path |
| 696 | .as_deref() |
| 697 | .and_then(|old| line_index.files.get(old)) |
| 698 | }); |
| 699 | let current_lines = file |
| 700 | .new_content |
| 701 | .as_deref() |
| 702 | .or(file.old_content.as_deref()) |
| 703 | .map(count_line_units) |
| 704 | .or_else(|| indexed.map(|idx| idx.lines.len())) |
| 705 | .unwrap_or(0); |
| 706 | let indexed_lines = indexed.map(|idx| idx.lines.len()).unwrap_or(0); |
| 707 | let imported_commits = indexed.map(|idx| idx.imported_commits).unwrap_or(0); |
| 708 | (current_lines, indexed_lines, imported_commits) |
| 709 | } |
| 710 | |
| 711 | fn import_shape_summary(parsed: &ParsedCommit, line_index: &ImportLineIndex) -> String { |
| 712 | let mut entries: Vec<(usize, String)> = parsed |
no test coverage detected