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

Function import_direct_can_apply

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

Source from the content-addressed store, hash-verified

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