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

Function import_direct_can_apply

atomic-repository/src/repository/insert.rs:229–259  ·  view source on GitHub ↗
(change: &Change)

Source from the content-addressed store, hash-verified

227}
228
229fn import_direct_can_apply(change: &Change) -> bool {
230 if change.hunks().is_empty() {
231 return true;
232 }
233
234 change.hunks().iter().all(|op| match op {
235 GraphOp::FileAdd {
236 add_name,
237 add_inode,
238 contents,
239 ..
240 } => {
241 add_name.successors.is_empty()
242 && add_inode.successors.is_empty()
243 && contents
244 .as_ref()
245 .map(|c| c.successors.is_empty())
246 .unwrap_or(true)
247 }
248 GraphOp::Edit {
249 change: atomic_core::change::Atom::Insertion(insertion),
250 ..
251 } => {
252 insertion.successors.is_empty()
253 && insertion.predecessors.len() == 1
254 && insertion.predecessors[0].change.is_none()
255 && insertion.inode.change.is_none()
256 }
257 _ => false,
258 })
259}
260
261fn import_seed_edge_visible(edge: &SerializedGraphEdge, visible: &HashSet<NodeId>) -> bool {
262 let change = edge.introduced_by();

Callers 1

write_import_recordedMethod · 0.85

Calls 7

as_refMethod · 0.80
is_noneMethod · 0.80
is_emptyMethod · 0.45
hunksMethod · 0.45
allMethod · 0.45
iterMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected