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

Function insert_from_view

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

`atomic insert view [--to ] [-n]` over InsertChanges — both --deps forms and the dry-run preview (the handler computes the plan with the same domain call the local body makes). Rendered with the local view-insert body's exact print functions.

(
    source: &str,
    target: Option<String>,
    allow_conflicts: bool,
    deps: bool,
    dry_run: bool,
)

Source from the content-addressed store, hash-verified

4076/// plan with the same domain call the local body makes). Rendered with
4077/// the local view-insert body's exact print functions.
4078pub fn insert_from_view(
4079 source: &str,
4080 target: Option<String>,
4081 allow_conflicts: bool,
4082 deps: bool,
4083 dry_run: bool,
4084) -> CliResult<bool> {
4085 let Some(session) = Service::open()? else {
4086 return Ok(false);
4087 };
4088 let request = insert_request(
4089 &session,
4090 Some(pb::insert_changes_request::Source::FromView(
4091 source.to_string(),
4092 )),
4093 target,
4094 allow_conflicts,
4095 deps,
4096 dry_run,
4097 );
4098 let response = insert_rpc(&session, request)?;
4099 let resolved_target = response.resolved_target_view.clone().unwrap_or_default();
4100 print_info(&format!(
4101 "Inserting changes from '{source}' to '{resolved_target}'..."
4102 ));
4103 let outcome = insert_cross_view_outcome(&response);
4104 super::insert::print_cross_view_outcome(&outcome, dry_run);
4105 if !dry_run {
4106 print_insert_refresh(&response, true);
4107 }
4108 Ok(true)
4109}
4110
4111/// `atomic insert tag <tag> [--from-view <source>] [--to <target>] [-n]`
4112/// over InsertChanges — the --from-view override rides tag_from_view (the

Callers 1

runMethod · 0.85

Calls 8

openFunction · 0.85
insert_requestFunction · 0.85
insert_rpcFunction · 0.85
print_infoFunction · 0.85
print_cross_view_outcomeFunction · 0.85
print_insert_refreshFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected