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

Function import_direct_can_apply

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

Source from the content-addressed store, hash-verified

899}
900
901fn import_direct_can_apply(change: &Change) -> bool {
902 if change.hunks().is_empty() {
903 return true;
904 }
905
906 change.hunks().iter().all(|op| match op {
907 GraphOp::FileAdd {
908 add_name,
909 add_inode,
910 contents,
911 ..
912 } => {
913 add_name.successors.is_empty()
914 && add_inode.successors.is_empty()
915 && contents
916 .as_ref()
917 .map(|c| c.successors.is_empty())
918 .unwrap_or(true)
919 }
920 GraphOp::Edit {
921 change: atomic_core::change::Atom::Insertion(insertion),
922 ..
923 } => {
924 insertion.successors.is_empty()
925 && insertion.predecessors.len() == 1
926 && insertion.predecessors[0].change.is_none()
927 && insertion.inode.change.is_none()
928 }
929 _ => false,
930 })
931}
932
933fn import_seed_edge_visible(
934 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