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

Function sandbox_create

atomic-cli/src/commands/rpc.rs:5974–6007  ·  view source on GitHub ↗

`atomic sandbox create` over CreateSandboxTree — every form. The handler resolves the destination (the same default), creates the draft when --from names one, provisions the copy-on-write tree, and the CLI prints the local report from the wire-carried outcome.

(args: &super::sandbox::Create)

Source from the content-addressed store, hash-verified

5972/// when --from names one, provisions the copy-on-write tree, and the CLI
5973/// prints the local report from the wire-carried outcome.
5974pub fn sandbox_create(args: &super::sandbox::Create) -> CliResult<bool> {
5975 let Some(session) = Service::open()? else {
5976 return Ok(false);
5977 };
5978 let request = pb::CreateSandboxTreeRequest {
5979 repository: Some(session.reference.clone()),
5980 meta: request_meta(),
5981 name: args.name.clone(),
5982 from_view: args.from.clone(),
5983 dest: args.dest.as_ref().map(|dest| dest.display().to_string()),
5984 view: args.view.clone(),
5985 };
5986 let response = session.create_sandbox_tree(request)?;
5987 println!("Sandbox '{}' created", args.name);
5988 println!(" Working tree: {}", response.resolved_dest);
5989 if response.created_draft {
5990 println!(
5991 " View: {} (new draft from '{}')",
5992 response.view,
5993 args.from.as_deref().unwrap_or("")
5994 );
5995 } else {
5996 println!(" View: {}", response.view);
5997 }
5998 println!(
5999 " Files cloned: {} (copy-on-write where supported)",
6000 response.files_cloned
6001 );
6002 println!(
6003 " Graph: shared (canonical {}/.atomic)",
6004 response.repo_root
6005 );
6006 Ok(true)
6007}
6008
6009/// `atomic sandbox stage` over StageSandboxImage — the base view, output
6010/// dir, and the staged report all ride the wire.

Callers 1

runMethod · 0.85

Calls 6

openFunction · 0.85
as_refMethod · 0.80
displayMethod · 0.80
request_metaFunction · 0.70
cloneMethod · 0.45
create_sandbox_treeMethod · 0.45

Tested by

no test coverage detected