| 907 | } |
| 908 | |
| 909 | fn 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 | |
| 941 | fn import_seed_edge_visible( |
| 942 | edge: &SerializedGraphEdge, |