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

Function orphan

libatomic/examples/replication_acceptance/fixture.rs:242–272  ·  view source on GitHub ↗
(binary: &Path, root: &Path, config: &Path)

Source from the content-addressed store, hash-verified

240 Ok((late, no_code))
241}
242pub fn orphan(binary: &Path, root: &Path, config: &Path) -> Result<Hash> {
243 let mut repo = Repository::open_existing(root)?;
244 repo.create_draft_view("orphan", "dev")?;
245 drop(repo);
246 cli(binary, root, config, &["view", "switch", "orphan"])?;
247 let repo = Repository::open_existing(root)?;
248 let working_copy = repo.require_working_copy_id()?;
249 write(root, "orphan.txt", b"unpromoted code\n")?;
250 let memory = "---\nentry_type: memory\nid: orphan-memory\n---\nOnly on orphan\n";
251 write(root, ".vault/memory/orphan.md", memory.as_bytes())?;
252 repo.vault_store(
253 "memory/orphan.md",
254 VaultEntryType::Memory,
255 b"Only on orphan\n".to_vec(),
256 json!({"id":"orphan-memory"}).to_string(),
257 )?;
258 let paths: Vec<String> = vec!["orphan.txt".into(), ".vault/memory/orphan.md".into()];
259 for path in &paths {
260 repo.add(working_copy, path, TrackingOptions::default())?;
261 }
262 let out = repo.record(
263 working_copy,
264 ChangeHeader::new("unpromoted work"),
265 RecordOptions::new()
266 .with_all(false)
267 .paths(paths)
268 .sync_vault(false)
269 .enrich_kg(false),
270 )?;
271 Ok(*out.hash())
272}

Callers 1

runFunction · 0.85

Calls 13

create_draft_viewMethod · 0.80
vault_storeMethod · 0.80
enrich_kgMethod · 0.80
cliFunction · 0.70
writeFunction · 0.70
as_bytesMethod · 0.45
addMethod · 0.45
recordMethod · 0.45
sync_vaultMethod · 0.45
pathsMethod · 0.45
with_allMethod · 0.45

Tested by

no test coverage detected