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

Method hint_other_views

atomic-cli/src/commands/clone/command.rs:807–833  ·  view source on GitHub ↗

Print a hint listing the other views available on the remote. Views already cloned (the requested view and its ancestor chain) are not hinted. Best-effort: silent if the server has no inventory endpoint or nothing else to clone.

(&self, remote: &HttpRemote, applied: &HashSet<String>)

Source from the content-addressed store, hash-verified

805 /// not hinted. Best-effort: silent if the server has no inventory
806 /// endpoint or nothing else to clone.
807 async fn hint_other_views(&self, remote: &HttpRemote, applied: &HashSet<String>) {
808 // A cheap ref advertisement (refs only, no change bodies) lists every
809 // view on the remote.
810 let Ok(adv) = remote.sync_pull(&SyncWants::advertise(vec![])).await else {
811 return;
812 };
813 let others: Vec<String> = adv
814 .refs
815 .into_iter()
816 .map(|r| r.name)
817 .filter(|name| name != &self.view && !applied.contains(name))
818 .collect();
819 if others.is_empty() {
820 return;
821 }
822
823 print_blank();
824 print_hint(&format!(
825 "This remote has {} other {}: {}",
826 others.len(),
827 if others.len() == 1 { "view" } else { "views" },
828 others.join(", ")
829 ));
830 print_hint(
831 "Clone them too with 'atomic clone --all-views', or list them with 'atomic view list --remote'.",
832 );
833 }
834
835 /// Async implementation of the clone command.
836 ///

Callers 1

run_asyncMethod · 0.80

Calls 6

print_blankFunction · 0.85
print_hintFunction · 0.85
sync_pullMethod · 0.80
into_iterMethod · 0.45
containsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected