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

Function rollback_inserts

atomic-cli/src/commands/git/parallel.rs:3890–3903  ·  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

3888/// a divergent or partial insert leaves the shared view exactly as it was
3889/// (SPEC §5 / D1-A). Best-effort: rollback failures are logged, not fatal.
3890fn rollback_inserts(repo: &Repository, view: &str, applied: &[ContentHash]) {
3891 use atomic_repository::UnrecordOptions;
3892 for hash in applied.iter().rev() {
3893 let options = UnrecordOptions::default().view(view.to_string());
3894 if let Err(e) = repo.unrecord(hash, options) {
3895 print_warning(&format!(
3896 "Failed to roll back inserted change {} from '{}': {}",
3897 &hash.to_base32()[..12],
3898 view,
3899 e
3900 ));
3901 }
3902 }
3903}
3904
3905/// Classify an imported commit as normal, merge, or squash.
3906fn classify_commit(info: &ImportedCommitInfo) -> CommitClassification {

Callers 1

try_squash_insertMethod · 0.85

Calls 4

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

Tested by

no test coverage detected