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

Function rollback_inserts

atomic-cli/src/commands/git/parallel.rs:8393–8406  ·  view source on GitHub ↗

Remove change refs a failed squash-insert added to `view`, newest first, so a divergent or partial insert leaves the shared view exactly as it was (SPEC §5 / D1-A). Best-effort: rollback failures are logged, not fatal.

(repo: &Repository, view: &str, applied: &[ContentHash])

Source from the content-addressed store, hash-verified

8391/// a divergent or partial insert leaves the shared view exactly as it was
8392/// (SPEC §5 / D1-A). Best-effort: rollback failures are logged, not fatal.
8393fn rollback_inserts(repo: &Repository, view: &str, applied: &[ContentHash]) {
8394 use atomic_repository::UnrecordOptions;
8395 for hash in applied.iter().rev() {
8396 let options = UnrecordOptions::default().view(view.to_string());
8397 if let Err(e) = repo.unrecord(hash, options) {
8398 print_warning(&format!(
8399 "Failed to roll back inserted change {} from '{}': {}",
8400 &hash.to_base32()[..12],
8401 view,
8402 e
8403 ));
8404 }
8405 }
8406}
8407
8408/// Classify an imported commit as normal, merge, or squash.
8409fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {

Callers 1

try_squash_insertMethod · 0.85

Calls 4

print_warningFunction · 0.85
iterMethod · 0.45
viewMethod · 0.45
unrecordMethod · 0.45

Tested by

no test coverage detected