| 899 | } |
| 900 | |
| 901 | fn 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 | |
| 933 | fn import_seed_edge_visible( |
| 934 | edge: &SerializedGraphEdge, |