mirror of
https://seed.radicle.dev/rad:z39mP9rQAaGmERfUMPULfPUi473tY.git
synced 2026-11-02 01:40:33 +08:00
36 lines
975 B
Rust
36 lines
975 B
Rust
pub mod fixtures {
|
|
use anyhow::Result;
|
|
|
|
use radicle::cob::cache::NoCache;
|
|
use radicle::patch::{Cache, MergeTarget, PatchMut, Patches};
|
|
use radicle::storage::git::Repository;
|
|
use radicle::test::setup::{BranchWith, NodeWithRepo};
|
|
|
|
pub fn node_with_repo() -> NodeWithRepo {
|
|
NodeWithRepo::default()
|
|
}
|
|
|
|
pub fn branch(node: &NodeWithRepo) -> BranchWith {
|
|
let checkout = node.repo.checkout();
|
|
checkout.branch_with([("README", b"Hello World!")])
|
|
}
|
|
|
|
pub fn patch<'a, 'g>(
|
|
node: &'a NodeWithRepo,
|
|
branch: &BranchWith,
|
|
patches: &'a mut Cache<Patches<'a, Repository>, NoCache>,
|
|
) -> Result<PatchMut<'a, 'g, Repository, NoCache>> {
|
|
let patch = patches.create(
|
|
"My first patch",
|
|
"Blah blah blah.",
|
|
MergeTarget::Delegates,
|
|
branch.base,
|
|
branch.oid,
|
|
&[],
|
|
&node.signer,
|
|
)?;
|
|
|
|
Ok(patch)
|
|
}
|
|
}
|