(file: &ParsedFile, line_index: &ImportLineIndex)
| 804 | } |
| 805 | |
| 806 | fn import_shape_for_file(file: &ParsedFile, line_index: &ImportLineIndex) -> (usize, usize, usize) { |
| 807 | let indexed = line_index.files.get(&file.path).or_else(|| { |
| 808 | file.old_path |
| 809 | .as_deref() |
| 810 | .and_then(|old| line_index.files.get(old)) |
| 811 | }); |
| 812 | let current_lines = file |
| 813 | .new_content |
| 814 | .as_deref() |
| 815 | .or(file.old_content.as_deref()) |
| 816 | .map(count_line_units) |
| 817 | .or_else(|| indexed.map(|idx| idx.lines.len())) |
| 818 | .unwrap_or(0); |
| 819 | let indexed_lines = indexed.map(|idx| idx.lines.len()).unwrap_or(0); |
| 820 | let imported_commits = indexed.map(|idx| idx.imported_commits).unwrap_or(0); |
| 821 | (current_lines, indexed_lines, imported_commits) |
| 822 | } |
| 823 | |
| 824 | fn import_shape_summary(parsed: &ParsedCommit, line_index: &ImportLineIndex) -> String { |
| 825 | let mut entries: Vec<(usize, String)> = parsed |
no test coverage detected