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

Function sandbox_create

atomic-cli/src/commands/rpc.rs:6014–6047  ·  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

6012/// when --from names one, provisions the copy-on-write tree, and the CLI
6013/// prints the local report from the wire-carried outcome.
6014pub fn sandbox_create(args: &super::sandbox::Create) -> CliResult<bool> {
6015 let Some(session) = Service::open()? else {
6016 return Ok(false);
6017 };
6018 let request = pb::CreateSandboxTreeRequest {
6019 repository: Some(session.reference.clone()),
6020 meta: request_meta(),
6021 name: args.name.clone(),
6022 from_view: args.from.clone(),
6023 dest: args.dest.as_ref().map(|dest| dest.display().to_string()),
6024 view: args.view.clone(),
6025 };
6026 let response = session.create_sandbox_tree(request)?;
6027 println!("Sandbox '{}' created", args.name);
6028 println!(" Working tree: {}", response.resolved_dest);
6029 if response.created_draft {
6030 println!(
6031 " View: {} (new draft from '{}')",
6032 response.view,
6033 args.from.as_deref().unwrap_or("")
6034 );
6035 } else {
6036 println!(" View: {}", response.view);
6037 }
6038 println!(
6039 " Files cloned: {} (copy-on-write where supported)",
6040 response.files_cloned
6041 );
6042 println!(
6043 " Graph: shared (canonical {}/.atomic)",
6044 response.repo_root
6045 );
6046 Ok(true)
6047}
6048
6049/// `atomic sandbox stage` over StageSandboxImage — the base view, output
6050/// dir, and the staged report all ride the wire.

Callers 1

runMethod · 0.85

Calls 6

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

Tested by

no test coverage detected