backport: squash and use cherry-pick, not rebase#2291
Merged
bors-ferrocene[bot] merged 10 commits intomainfrom Apr 24, 2026
Merged
backport: squash and use cherry-pick, not rebase#2291bors-ferrocene[bot] merged 10 commits intomainfrom
cherry-pick, not rebase#2291bors-ferrocene[bot] merged 10 commits intomainfrom
Conversation
fb9c1b7 to
810e61f
Compare
This comment was marked as resolved.
This comment was marked as resolved.
4288805 to
664fa4f
Compare
664fa4f to
91a51f1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
91a51f1 to
35d8924
Compare
35d8924 to
a400cd8
Compare
git apply && commit, not rebasecherry-pick, not rebase
Urhengulas
requested changes
Apr 16, 2026
Member
Urhengulas
left a comment
There was a problem hiding this comment.
The last commit says it wants to be removed as well
a400cd8 to
77f4a2f
Compare
Before it would error: ``` fatal: Does not point to a valid commit '' ```
A rebase workflow has several problems: - Firstly, it's just a lot more complicated. It uses a temporary branch, an "interactive" non-interactive editor, and several levels of nesting across processes. - Secondly, it requires *every* commit in a PR to rebase successfully, not just the PR's diff. This increases the number of PRs that have to be rebased manually, and increases the workload while manually rebasing. Using `git apply` allows us to avoid both issues.
- Put mergiraf changes in a separate commit
77f4a2f to
dd5e098
Compare
bors-ferrocene Bot
added a commit
that referenced
this pull request
Apr 24, 2026
2291: backport: squash and use `cherry-pick`, not rebase r=Urhengulas a=jyn514 This hits many fewer conflicts when backporting. Now, instead of requiring every commit to backport cleanly, we only require the diff between `main` and the PR to backport cleanly. This decreases the fraction of PRs that need to be submitted manually, and also reduces the manual work needed to backport PRs when a manual backport is needed. There are also various other changes to make the backporting scripts more maintainable and testable; see each individual commit for details. Unlike before, this does not mess with the current git state; running `git cherry-pick --abort` puts you back in exactly the same state you were in before you ran `one.py`. See #2301 for an example PR opened by this automation, and https://github.com/ferrocene/ferrocene/actions/runs/24351997960/job/71108663815 for a sample job output. --- ## Testing Here is a sample session using `one.py` to do a manual backport for the upcoming release: ```console $ git checkout origin/release/1.95 HEAD is now at a31dd5c Merge #2258 $ git checkout jyn/backport-automation ferrocene/tools/backport ferrocene/tools/automations-common $ ferrocene/tools/backport/one.py 2245 ERROR: this script cannot be run when you have staged changes; try running `git reset` $ git reset Unstaged changes after reset: M ferrocene/tools/automations-common/src/automations_common/automated_prs.py M ferrocene/tools/backport/all.py M ferrocene/tools/backport/one.py $ ferrocene/tools/backport/one.py 2245 17:45 warning: if no API token is set in the GITHUB_TOKEN env var, requests may be rate-limited INFO: backporting #2245 to a31dd5c (please do not CTRL-C) Auto-merging .circleci/workflows.yml Auto-merging ferrocene/ci/scripts/setup-uv.sh CONFLICT (content): Merge conflict in ferrocene/ci/scripts/setup-uv.sh error: could not apply d3faae633305... Backport #2245 ERROR: Encountered a merge conflict backporting #2245 INFO: attempting to auto-solve conflicts with mergiraf WARN Mergiraf: Could not find a supported language for ferrocene/ci/scripts/setup-uv.sh HELP: Fix the conflicts, run 'git add/rm <filepath>', then run 'git cherry-pick --continue'. NOTE: Running 'git cherry-pick --abort' will put you back in your original git state. NOTE: conflicts exist in the following locations: ferrocene/ci/scripts/setup-uv.sh:7-17 NOTE: 'HEAD' in the conflicted files refers to your current branch, a31dd5c $ git diff --name-status --cached M .circleci/workflows.yml U ferrocene/ci/scripts/setup-uv.sh $ git status | head -n5 HEAD detached at origin/release/1.95 You are currently cherry-picking commit d3faae633305. (fix conflicts and run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) ``` (After this lands on beta, the `git checkout ferrocene/tools && git reset` lines will no longer be needed.) 2336: Fix several bugs in `ferrocene::prevalidated` r=Urhengulas a=jyn514 Thanks to `@Urhengulas` for catching these. 1. The THIR pass didn't check associated items at all. This is fixed in the first commit and tested in `tests/ui/ferrocene/lint-prevalidated/thir-impl-item.rs`. The second commit adds the missing items to libcore. 2. The post-mono pass didn't check dynamic casts. I had correctly "failed closed" here -- the THIR pass would ICE if it wasn't able to check a cast — but because of 1. there were several casts in libcore that weren't caught, including in libcore. The ICE is fixed in the third commit and the post-mono pass is extended in the fourth. This is tested in `tests/ui/ferrocene/lint-prevalidated/dyn-cast-post-mono.rs`. 3. The post-mono pass can't handle MIR inlining. I tried to get this working (see https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/SourceScopeData.20-.3E.20SourceScope/with/590200295), but wasn't able to figure out how to do it reliably. Instead I just disable mir inlining in the 5th commit. This is tested in `tests/ui/ferrocene/lint-prevalidated/mir-inlining.rs`. Co-authored-by: Jynn Nelson <[email protected]> Co-authored-by: Urhengulas <[email protected]>
Contributor
|
Build failed (retrying...): |
Contributor
|
Build succeeded:
|
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.
This hits many fewer conflicts when backporting. Now, instead of requiring every commit to backport cleanly, we only require the diff between
mainand the PR to backport cleanly. This decreases the fraction of PRs that need to be submitted manually, and also reduces the manual work needed to backport PRs when a manual backport is needed.There are also various other changes to make the backporting scripts more maintainable and testable; see each individual commit for details. Unlike before, this does not mess with the current git state; running
git cherry-pick --abortputs you back in exactly the same state you were in before you ranone.py.See #2301 for an example PR opened by this automation, and https://github.com/ferrocene/ferrocene/actions/runs/24351997960/job/71108663815 for a sample job output.
Testing
Here is a sample session using
one.pyto do a manual backport for the upcoming release:(After this lands on beta, the
git checkout ferrocene/tools && git resetlines will no longer be needed.)