fix(sync): abort failed rebase during --all-branches and report it#32
Merged
Conversation
Under --all-branches a rebase conflict previously left git mid-rebase, which blocked the git switch to the next branch and the final branch restore. Add abort_on_conflict to _sync_repository: when set (only by --all-branches) a failed rebase is aborted so the tree stays clean, the loop continues, and the original branch is restored. Failed branches are listed at the end with a manual-rebase hint. Single-repo sync is unchanged (still leaves the rebase in progress for in-place conflict resolution).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dbx sync --all-branchesiterates over each mapped branch withgit switch. Previously, if a branch's rebase hit conflicts (or targeted a missing upstream ref),_sync_repositoryreturned"failed"but left git mid-rebase. That in-progress rebase then blocked thegit switchto every remaining branch and the final restore of the original branch — one bad branch poisoned the whole run and left the repo in a surprising state.Fix
Add
abort_on_conflictto_sync_repository. When set, a failed rebase isgit rebase --abort'd so the working tree is left clean, and the user is pointed at a manual rebase command.--all-branchespassesabort_on_conflict=True; single-repodbx sync <repo>is unchanged (still leaves the rebase in progress for in-place conflict resolution).The loop now collects failed branches and prints them at the end:
Testing
test_repo_sync_all_branches_aborts_failed_rebase: first branch's rebase fails → verifiesgit rebase --abortruns, the loop continues to the next branch, the original branch is restored, and the failed branch is reported.Docs
docs/features/django-fork.rst"Refreshing every release branch" documents the abort-and-report behavior with a manual-rebase recipe.