Unified · Split
| @@ -50,8 +50,8 @@ struct Opts { · 49 unmodified lines | |||
| 50 | /// Omit personally identifiable information, leaving only the summary. | 50 | /// Omit personally identifiable information, leaving only the summary. |
| 51 | #[clap(short = 'p', long)] | 51 | #[clap(short = 'p', long)] |
| 52 | omit_pii: bool, | 52 | omit_pii: bool, |
| 53 | /// Unify identities by name and email | 53 | /// Unify identities by name and email. |
| 54 | #[clap(short = 'i', long)] | 54 | #[clap(short = 'i', long, conflicts_with = "omit-pii")] |
| 55 | unify_identities: bool, | 55 | unify_identities: bool, |
| 56 | } | 56 | } |
| 57 | 57 | ||
| @@ -146,7 +146,16 @@ fn main() -> anyhow::Result<()> { · 88 unmodified lines | |||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | let mut results_by_hours = if opts.unify_identities { | 148 | let mut results_by_hours = if opts.unify_identities { |
| 149 | deduplicate_identities(&results_by_hours) | 149 | let start = Instant::now(); |
| 150 | let res = deduplicate_identities(&results_by_hours); | ||
| 151 | let elapsed = start.elapsed(); | ||
| 152 | eprintln!( | ||
| 153 | "Deduplicated {} contributors in {:.02}s by name and email, now {}", | ||
| 154 | results_by_hours.len(), | ||
| 155 | elapsed.as_secs_f32(), | ||
| 156 | res.len() | ||
| 157 | ); | ||
| 158 | res | ||
| 150 | } else { | 159 | } else { |
| 151 | results_by_hours | 160 | results_by_hours |
| 152 | .iter() | 161 | .iter() |
| @@ -211,7 +220,7 @@ fn estimate_hours(commits: &[git_object::mutable::Signature]) -> WorkByEmail { · 58 unmodified lines | |||
| 211 | } | 220 | } |
| 212 | 221 | ||
| 213 | fn deduplicate_identities(persons: &[WorkByEmail]) -> Vec<WorkByPerson<'_>> { | 222 | fn deduplicate_identities(persons: &[WorkByEmail]) -> Vec<WorkByPerson<'_>> { |
| 214 | let mut out = Vec::<WorkByPerson>::new(); | 223 | let mut out = Vec::<WorkByPerson>::with_capacity(persons.len()); |
| 215 | for person_by_email in persons { | 224 | for person_by_email in persons { |
| 216 | match out | 225 | match out |
| 217 | .iter_mut() | 226 | .iter_mut() |