| 228 | } |
| 229 | |
| 230 | fn 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 | |
| 262 | fn import_seed_edge_visible(edge: &SerializedGraphEdge, visible: &HashSet<NodeId>) -> bool { |
| 263 | let change = edge.introduced_by(); |