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

Method hint_other_views

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

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

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