Check if local and remote histories have diverged.
(local_entries: &[HistoryEntry], remote_entries: &[ChangelistEntry])
| 113 | |
| 114 | /// Check if local and remote histories have diverged. |
| 115 | fn has_diverged(local_entries: &[HistoryEntry], remote_entries: &[ChangelistEntry]) -> bool { |
| 116 | if remote_entries.is_empty() { |
| 117 | return false; |
| 118 | } |
| 119 | |
| 120 | let local_hashes: HashSet<String> = local_entries.iter().map(|e| e.hash.to_base32()).collect(); |
| 121 | |
| 122 | remote_entries |
| 123 | .iter() |
| 124 | .any(|e| !local_hashes.contains(&e.hash)) |
| 125 | } |
| 126 | |
| 127 | /// Format a count with singular/plural suffix. |
| 128 | fn format_count(count: usize, singular: &str) -> String { |