| 227 | } |
| 228 | |
| 229 | fn import_direct_can_apply(change: &Change) -> bool { |
| 230 | if change.hunks().is_empty() { |
| 231 | return true; |
| 232 | } |
| 233 | |
| 234 | change.hunks().iter().all(|op| match op { |
| 235 | GraphOp::FileAdd { |
| 236 | add_name, |
| 237 | add_inode, |
| 238 | contents, |
| 239 | .. |
| 240 | } => { |
| 241 | add_name.successors.is_empty() |
| 242 | && add_inode.successors.is_empty() |
| 243 | && contents |
| 244 | .as_ref() |
| 245 | .map(|c| c.successors.is_empty()) |
| 246 | .unwrap_or(true) |
| 247 | } |
| 248 | GraphOp::Edit { |
| 249 | change: atomic_core::change::Atom::Insertion(insertion), |
| 250 | .. |
| 251 | } => { |
| 252 | insertion.successors.is_empty() |
| 253 | && insertion.predecessors.len() == 1 |
| 254 | && insertion.predecessors[0].change.is_none() |
| 255 | && insertion.inode.change.is_none() |
| 256 | } |
| 257 | _ => false, |
| 258 | }) |
| 259 | } |
| 260 | |
| 261 | fn import_seed_edge_visible(edge: &SerializedGraphEdge, visible: &HashSet<NodeId>) -> bool { |
| 262 | let change = edge.introduced_by(); |