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

Function seed

atomic-repository/src/repository/content.rs:1667–1680  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1665 }
1666
1667 fn seed() -> (tempfile::TempDir, Repository, Inode, Position<NodeId>) {
1668 let dir = tempfile::tempdir().unwrap();
1669 let repo = Repository::init(dir.path()).unwrap();
1670 let wc = repo.require_working_copy_id().unwrap();
1671 std::fs::write(dir.path().join("live.txt"), b"one\ntwo\nthree\n").unwrap();
1672 repo.add(wc, "live.txt", TrackingOptions::default())
1673 .unwrap();
1674 record(&repo, "seed");
1675 let txn = repo.pristine.read_txn().unwrap();
1676 let inode = txn.get_inode("live.txt").unwrap().unwrap();
1677 let position = txn.inode_position(inode).unwrap().unwrap();
1678 drop(txn);
1679 (dir, repo, inode, position)
1680 }
1681
1682 fn assert_verdict(repo: &Repository, inode: Inode, position: Position<NodeId>, expected: bool) {
1683 let txn = repo.pristine.read_txn().unwrap();

Calls 10

read_txnMethod · 0.80
recordFunction · 0.70
initFunction · 0.50
writeFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
get_inodeMethod · 0.45
inode_positionMethod · 0.45