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

Method hint_other_views

atomic-cli/src/commands/clone/command.rs:916–942  ·  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

914 /// not hinted. Best-effort: silent if the server has no inventory
915 /// endpoint or nothing else to clone.
916 async fn hint_other_views(&self, remote: &HttpRemote, applied: &HashSet<String>) {
917 // A cheap ref advertisement (refs only, no change bodies) lists every
918 // view on the remote.
919 let Ok(adv) = remote.sync_pull(&SyncWants::advertise(vec![])).await else {
920 return;
921 };
922 let others: Vec<String> = adv
923 .refs
924 .into_iter()
925 .map(|r| r.name)
926 .filter(|name| name != &self.view && !applied.contains(name))
927 .collect();
928 if others.is_empty() {
929 return;
930 }
931
932 print_blank();
933 print_hint(&format!(
934 "This remote has {} other {}: {}",
935 others.len(),
936 if others.len() == 1 { "view" } else { "views" },
937 others.join(", ")
938 ));
939 print_hint(
940 "Clone them too with 'atomic clone --all-views', or list them with 'atomic view list --remote'.",
941 );
942 }
943
944 /// Async implementation of the clone command.
945 ///

Callers 1

run_asyncMethod · 0.80

Calls 7

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

Tested by

no test coverage detected