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

Function host

libatomic/tests/record_service_test.rs:33–59  ·  view source on GitHub ↗

A repository with one change on `dev`.

()

Source from the content-addressed store, hash-verified

31
32/// A repository with one change on `dev`.
33fn host() -> (TempDir, std::path::PathBuf, Arc<DaemonState>, RepositoryRef) {
34 let dir = TempDir::new().unwrap();
35 let root = dir.path().join("repo");
36 {
37 let repo = Repository::init(&root).unwrap();
38 let working_copy = repo.require_working_copy_id().unwrap();
39 write(&root, "README.md", "hello\n");
40 repo.add(working_copy, "README.md", TrackingOptions::default())
41 .unwrap();
42 let header = ChangeHeader::builder().message("first").build();
43 let outcome = repo
44 .record(
45 working_copy,
46 header,
47 RecordOptions::new()
48 .with_all(true)
49 .save_to_store(true)
50 .apply_after_record(true),
51 )
52 .unwrap();
53 assert!(outcome.was_applied());
54 }
55 let state = Arc::new(DaemonState::new());
56 let root = root.canonicalize().unwrap();
57 let repository = state.register(root.clone()).repository_ref();
58 (dir, root, state, repository)
59}
60
61fn record_request(repository: &RepositoryRef) -> RecordRequest {
62 RecordRequest {

Calls 15

apply_after_recordMethod · 0.80
save_to_storeMethod · 0.80
canonicalizeMethod · 0.80
repository_refMethod · 0.80
writeFunction · 0.70
initFunction · 0.50
unwrapMethod · 0.45
pathMethod · 0.45
addMethod · 0.45
buildMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected