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

Method put_branch

atomic-core/src/crdt/apply/traits.rs:556–568  ·  view source on GitHub ↗
(
            &mut self,
            branch: &Branch,
            _after: Option<BranchId>,
        )

Source from the content-addressed store, hash-verified

554 }
555
556 fn put_branch(
557 &mut self,
558 branch: &Branch,
559 _after: Option<BranchId>,
560 ) -> Result<bool, Self::Error> {
561 let is_new = !self.branches.contains_key(&branch.id());
562 self.branches.insert(branch.id(), branch.clone());
563 self.trunk_branches
564 .entry(branch.trunk())
565 .or_default()
566 .push(branch.id());
567 Ok(is_new)
568 }
569
570 fn get_branch(&self, id: BranchId) -> Result<Option<Branch>, Self::Error> {
571 Ok(self.branches.get(&id).cloned())

Callers 3

create_branchMethod · 0.45
test_list_branchesFunction · 0.45
test_count_branchesFunction · 0.45

Calls 6

contains_keyMethod · 0.80
idMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45
trunkMethod · 0.45

Tested by 2

test_list_branchesFunction · 0.36
test_count_branchesFunction · 0.36