A repository with two recorded files on `dev`, and a state serving it.
(state: DaemonState)
| 97 | |
| 98 | /// A repository with two recorded files on `dev`, and a state serving it. |
| 99 | fn host_with(state: DaemonState) -> Host { |
| 100 | let dir = TempDir::new().unwrap(); |
| 101 | let root = dir.path().join("repo"); |
| 102 | { |
| 103 | let repo = Repository::init(&root).unwrap(); |
| 104 | let working_copy = repo.require_working_copy_id().unwrap(); |
| 105 | write(&root, "README.md", "hello\n"); |
| 106 | write(&root, "src/lib.rs", "pub fn f() {}\n"); |
| 107 | repo.add(working_copy, "README.md", TrackingOptions::default()) |
| 108 | .unwrap(); |
| 109 | repo.add(working_copy, "src/lib.rs", TrackingOptions::default()) |
| 110 | .unwrap(); |
| 111 | record(&repo, "first").unwrap(); |
| 112 | } |
| 113 | let state = Arc::new(state); |
| 114 | let repository = state.register(root.clone()).repository_ref(); |
| 115 | let root = root.canonicalize().unwrap(); |
| 116 | Host { |
| 117 | _dir: dir, |
| 118 | root, |
| 119 | state, |
| 120 | repository, |
| 121 | rt: tokio::runtime::Builder::new_multi_thread() |
| 122 | .worker_threads(4) |
| 123 | .enable_all() |
| 124 | .build() |
| 125 | .unwrap(), |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | impl Host { |
| 130 | /// The repository, opened for the closure only: the handlers open it per |
no test coverage detected