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

Function graph_export

atomic-cli/tests/it/graph_only_export_cb9b_test.rs:132–144  ·  view source on GitHub ↗

Export a set of paths from the recorded graph and return the bytes.

(root: &Path, view: &str, paths: &[&str])

Source from the content-addressed store, hash-verified

130
131/// Export a set of paths from the recorded graph and return the bytes.
132fn graph_export(root: &Path, view: &str, paths: &[&str]) -> (Vec<(String, Vec<u8>)>, Duration) {
133 let repo = open_repo(root);
134 let start = Instant::now();
135 let mut out = Vec::new();
136 for path in paths {
137 let bytes = repo
138 .get_file_content_on_view(path, view)
139 .unwrap_or_else(|error| panic!("graph export failed for {path}: {error}"))
140 .unwrap_or_else(|| panic!("graph export missing {path}"));
141 out.push((path.to_string(), bytes));
142 }
143 (out, start.elapsed())
144}
145
146fn assert_export_matches(root: &Path, view: &str, expected: &[(&str, Vec<u8>)], bound: Duration) {
147 clear_worktree(root);

Callers 1

assert_export_matchesFunction · 0.85

Calls 3

open_repoFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected