| 294 | use serial_test::file_serial; |
| 295 | |
| 296 | fn orphan_repo() -> (tempfile::TempDir, Repository, atomic_core::types::Hash) { |
| 297 | use atomic_core::pristine::{MutTxnT, ViewScope, ViewTxnT}; |
| 298 | let temp = tempfile::tempdir().unwrap(); |
| 299 | let repo = Repository::init(temp.path()).unwrap(); |
| 300 | let hash = atomic_core::types::Hash::of(b"unique change"); |
| 301 | let mut txn = repo.pristine().write_txn().unwrap(); |
| 302 | let parent = txn.get_view(repo.current_view()).unwrap().unwrap(); |
| 303 | let mut draft = txn |
| 304 | .create_view("wip", ViewScope::Draft, Some(parent.id)) |
| 305 | .unwrap(); |
| 306 | let id = txn.register_change(&hash).unwrap(); |
| 307 | txn.put_change(&mut draft, id, &hash).unwrap(); |
| 308 | txn.put_change_deps(id, &[]).unwrap(); |
| 309 | txn.update_view(&draft).unwrap(); |
| 310 | txn.commit().unwrap(); |
| 311 | (temp, repo, hash) |
| 312 | } |
| 313 | |
| 314 | #[test] |
| 315 | fn declining_or_failed_confirmation_keeps_orphan_candidate_referenced() { |