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

Method new

atomic-cli/tests/it/record_rename_attributes_test.rs:43–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41
42impl Fixture {
43 fn new() -> Self {
44 let root = TempDir::new().unwrap();
45 let home = TempDir::new().unwrap();
46 atomic(root.path(), home.path(), &["init", "--no-vault"]);
47 fs::write(root.path().join("old.txt"), BASE).unwrap();
48 #[cfg(unix)]
49 {
50 use std::os::unix::fs::PermissionsExt;
51 fs::set_permissions(
52 root.path().join("old.txt"),
53 fs::Permissions::from_mode(0o644),
54 )
55 .unwrap();
56 }
57 atomic(root.path(), home.path(), &["add", "old.txt"]);
58 atomic(
59 root.path(),
60 home.path(),
61 &["record", "-am", "base", "--author", "Rename Test"],
62 );
63 assert!(!root.path().join(".git").exists());
64 let mut repo = Repository::open(root.path()).unwrap();
65 let inode = repo.get_file_inode("old.txt").unwrap().unwrap();
66 let txn = repo.pristine().read_txn().unwrap();
67 let position = txn.inode_position(inode).unwrap().unwrap();
68 let trunk = decode_trunk_id(&txn.get_crdt_inode_trunk(inode.get()).unwrap().unwrap());
69 drop(txn);
70 let current = repo.current_view().to_string();
71 repo.create_view_from("before-rename", &current).unwrap();
72 repo.create_view_from("rename-work", &current).unwrap();
73 repo.switch_view(repo.require_working_copy_id().unwrap(), "rename-work")
74 .unwrap();
75 Self {
76 root,
77 home,
78 inode,
79 position,
80 trunk,
81 }
82 }
83
84 fn atomic(&self, args: &[&str]) {
85 atomic(self.root.path(), self.home.path(), args);

Callers

nothing calls this directly

Calls 15

set_permissionsFunction · 0.85
openFunction · 0.85
decode_trunk_idFunction · 0.85
get_file_inodeMethod · 0.80
read_txnMethod · 0.80
pristineMethod · 0.80
create_view_fromMethod · 0.80
atomicFunction · 0.70
writeFunction · 0.70
getMethod · 0.65
unwrapMethod · 0.45

Tested by

no test coverage detected