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

Method record

atomic-cli/tests/it/record_rename_attributes_test.rs:96–123  ·  view source on GitHub ↗
(&self, all: bool)

Source from the content-addressed store, hash-verified

94 }
95
96 fn record(&self, all: bool) -> Change {
97 self.atomic(&[
98 "record",
99 if all { "-am" } else { "-m" },
100 "rename",
101 "--author",
102 "Rename Test",
103 ]);
104 let repo = Repository::open(self.root.path()).unwrap();
105 let history = repo.log(HistoryOptions::default()).unwrap();
106 let latest = history.iter().max_by_key(|entry| entry.sequence).unwrap();
107 let change = repo.load_change(&latest.hash).unwrap();
108 assert_eq!(
109 change
110 .hunks()
111 .iter()
112 .filter(|op| matches!(op, GraphOp::FileMove { path, .. } if path == "new.txt"))
113 .count(),
114 1
115 );
116 assert!(!change
117 .hunks()
118 .iter()
119 .any(|op| matches!(op, GraphOp::FileAdd { .. } | GraphOp::FileDel { .. })));
120 assert!(change.file_ops().iter().any(|ops| matches!(ops.trunk_op(), Some(TrunkOp::Move { trunk, .. }) if *trunk == self.trunk)));
121 self.assert_identity(&repo);
122 change
123 }
124
125 fn assert_identity(&self, repo: &Repository) {
126 assert_eq!(repo.get_file_inode("new.txt").unwrap(), Some(self.inode));

Calls 8

openFunction · 0.85
assert_identityMethod · 0.80
atomicMethod · 0.45
unwrapMethod · 0.45
pathMethod · 0.45
logMethod · 0.45
iterMethod · 0.45
load_changeMethod · 0.45

Tested by

no test coverage detected