MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / has_diverged

Function has_diverged

atomic-cli/tests/push_integration_test.rs:115–125  ·  view source on GitHub ↗

Check if local and remote histories have diverged.

(local_entries: &[HistoryEntry], remote_entries: &[ChangelistEntry])

Source from the content-addressed store, hash-verified

113
114/// Check if local and remote histories have diverged.
115fn 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.
128fn format_count(count: usize, singular: &str) -> String {

Callers

nothing calls this directly

Calls 4

is_emptyMethod · 0.45
iterMethod · 0.45
to_base32Method · 0.45
containsMethod · 0.45

Tested by

no test coverage detected