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

Function import_direct_can_apply

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

Source from the content-addressed store, hash-verified

907}
908
909fn import_direct_can_apply(change: &Change) -> bool {
910 if change.hunks().is_empty() {
911 return true;
912 }
913
914 change.hunks().iter().all(|op| match op {
915 GraphOp::FileAdd {
916 add_name,
917 add_inode,
918 contents,
919 ..
920 } => {
921 add_name.successors.is_empty()
922 && add_inode.successors.is_empty()
923 && contents
924 .as_ref()
925 .map(|c| c.successors.is_empty())
926 .unwrap_or(true)
927 }
928 GraphOp::Edit {
929 change: atomic_core::change::Atom::Insertion(insertion),
930 ..
931 } => {
932 insertion.successors.is_empty()
933 && insertion.predecessors.len() == 1
934 && insertion.predecessors[0].change.is_none()
935 && insertion.inode.change.is_none()
936 }
937 _ => false,
938 })
939}
940
941fn import_seed_edge_visible(
942 edge: &SerializedGraphEdge,

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