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

Method clone_additional_views

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

Clone every remote view other than the primary `--view`. Each view is created locally (as a shared view, matching how the server stores pushed views) and populated from its remote changelist. Changes are content-addressed, so any already downloaded for the primary view are reused — only genuinely new changes are fetched. Returns the number of additional views cloned.

(
        &self,
        repo: &mut Repository,
        remote: &HttpRemote,
        stats: &mut CloneStats,
    )

Source from the content-addressed store, hash-verified

309 /// primary view are reused — only genuinely new changes are fetched.
310 /// Returns the number of additional views cloned.
311 async fn clone_additional_views(
312 &self,
313 repo: &mut Repository,
314 remote: &HttpRemote,
315 stats: &mut CloneStats,
316 ) -> CliResult<usize> {
317 let remote_views = match remote.list_views().await {
318 Ok(v) => v,
319 // Older servers don't expose the inventory — treat as single-view.
320 Err(_) => return Ok(0),
321 };
322
323 let others: Vec<String> = remote_views
324 .into_iter()
325 .map(|v| v.name)
326 .filter(|name| name != &self.view)
327 .collect();
328
329 if others.is_empty() {
330 return Ok(0);
331 }
332
333 print_blank();
334 println!(
335 "Cloning {} additional {}:",
336 others.len(),
337 if others.len() == 1 { "view" } else { "views" }
338 );
339
340 let mut cloned = 0usize;
341 for name in &others {
342 match self.clone_one_view(repo, remote, name, stats).await {
343 Ok(applied) => {
344 cloned += 1;
345 println!(
346 " {} {} ({})",
347 success("\u{2713}"),
348 style_view(name),
349 format_count(applied, "change")
350 );
351 }
352 Err(e) => {
353 print_warning(&format!("Failed to clone view '{}': {}", name, e));
354 }
355 }
356 }
357
358 Ok(cloned)
359 }
360
361 /// Create one view locally and populate it from its remote changelist.
362 ///

Callers 1

run_asyncMethod · 0.80

Calls 6

print_blankFunction · 0.85
print_warningFunction · 0.85
clone_one_viewMethod · 0.80
list_viewsMethod · 0.45
into_iterMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected