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

Function orphan_repo

atomic-cli/src/commands/view/delete.rs:296–312  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

294 use serial_test::file_serial;
295
296 fn orphan_repo() -> (tempfile::TempDir, Repository, atomic_core::types::Hash) {
297 use atomic_core::pristine::{MutTxnT, ViewScope, ViewTxnT};
298 let temp = tempfile::tempdir().unwrap();
299 let repo = Repository::init(temp.path()).unwrap();
300 let hash = atomic_core::types::Hash::of(b"unique change");
301 let mut txn = repo.pristine().write_txn().unwrap();
302 let parent = txn.get_view(repo.current_view()).unwrap().unwrap();
303 let mut draft = txn
304 .create_view("wip", ViewScope::Draft, Some(parent.id))
305 .unwrap();
306 let id = txn.register_change(&hash).unwrap();
307 txn.put_change(&mut draft, id, &hash).unwrap();
308 txn.put_change_deps(id, &[]).unwrap();
309 txn.update_view(&draft).unwrap();
310 txn.commit().unwrap();
311 (temp, repo, hash)
312 }
313
314 #[test]
315 fn declining_or_failed_confirmation_keeps_orphan_candidate_referenced() {

Calls 13

write_txnMethod · 0.80
pristineMethod · 0.80
register_changeMethod · 0.80
put_changeMethod · 0.80
put_change_depsMethod · 0.80
update_viewMethod · 0.80
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
get_viewMethod · 0.45
current_viewMethod · 0.45
create_viewMethod · 0.45