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

Function insert_from_view

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

4113/// plan with the same domain call the local body makes). Rendered with
4114/// the local view-insert body's exact print functions.
4115pub fn insert_from_view(
4116 source: &str,
4117 target: Option<String>,
4118 allow_conflicts: bool,
4119 deps: bool,
4120 dry_run: bool,
4121) -> CliResult<bool> {
4122 let Some(session) = Service::open()? else {
4123 return Ok(false);
4124 };
4125 let request = insert_request(
4126 &session,
4127 Some(pb::insert_changes_request::Source::FromView(
4128 source.to_string(),
4129 )),
4130 target,
4131 allow_conflicts,
4132 deps,
4133 dry_run,
4134 );
4135 let response = insert_rpc(&session, request)?;
4136 let resolved_target = response.resolved_target_view.clone().unwrap_or_default();
4137 print_info(&format!(
4138 "Inserting changes from '{source}' to '{resolved_target}'..."
4139 ));
4140 let outcome = insert_cross_view_outcome(&response);
4141 super::insert::print_cross_view_outcome(&outcome, dry_run);
4142 if !dry_run {
4143 print_insert_refresh(&response, true);
4144 }
4145 Ok(true)
4146}
4147
4148/// `atomic insert tag <tag> [--from-view <source>] [--to <target>] [-n]`
4149/// over InsertChanges — the --from-view override rides tag_from_view (the

Callers 1

runMethod · 0.85

Calls 8

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

Tested by

no test coverage detected