feat(rust): port stack fixup to native Rust#1518
Open
jd wants to merge 1 commit into
Conversation
Member
Author
|
This pull request is part of a Mergify stack:
|
This was referenced Jun 3, 2026
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 ⛓️ Depends-On RequirementsWaiting for
This rule is failing.Requirement based on the presence of
🔴 👀 Review RequirementsWaiting for
This rule is failing.
🔴 🔎 ReviewsWaiting for
This rule is failing.
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
This was referenced Jun 3, 2026
The Rust binary now serves ``mergify stack fixup <COMMIT>...
[--dry-run]`` natively. The Python implementation
(``stack_fixup`` in ``mergify_cli/stack/squash.py``, its click
registration, and ``TestStackFixup`` in
``mergify_cli/tests/stack/test_squash.py``) is removed in the
same PR; ``stack_squash`` stays put.
Builds on the rebase-todo machinery: this slice adds
``Action::Fixup { shas }`` to ``mergify_stack::rebase_todo``
(rewrites the targeted ``pick`` lines to ``fixup``, preserving
the diff so it folds into the previous commit) and an ``Fixup``
variant on the ``_internal rebase-todo-rewrite --action`` enum.
Validation mirrors Python: each ``<COMMIT>`` argument resolves
against the stack walker by SHA-prefix or Change-Id prefix;
duplicates are rejected; the first commit of the stack is
rejected because it has no parent inside the stack to fold
into.
End-to-end coverage in
``crates/mergify-cli/tests/stack_fixup.rs`` (4 cases): folds B
into A leaving [A, C], dry-run is a no-op, first-commit fixup
is rejected, unknown prefix exits non-zero. The pure
transformer is covered by 3 new ``rebase_todo`` unit tests.
The pick→fixup transform shares its implementation with a new
generalised ``rewrite_replace_verb`` helper in ``rebase_todo``
— ``reword`` will slot into the same shape when that port
follows.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Change-Id: I7a139112fd95ef2b1e5bd2763cb62b0b9b2f5879
cf3869f to
c431f4c
Compare
Member
Author
Revision history
|
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.
The Rust binary now serves
mergify stack fixup <COMMIT>... [--dry-run]natively. The Python implementation(
stack_fixupinmergify_cli/stack/squash.py, its clickregistration, and
TestStackFixupinmergify_cli/tests/stack/test_squash.py) is removed in thesame PR;
stack_squashstays put.Builds on the rebase-todo machinery: this slice adds
Action::Fixup { shas }tomergify_stack::rebase_todo(rewrites the targeted
picklines tofixup, preservingthe diff so it folds into the previous commit) and an
Fixupvariant on the
_internal rebase-todo-rewrite --actionenum.Validation mirrors Python: each
<COMMIT>argument resolvesagainst the stack walker by SHA-prefix or Change-Id prefix;
duplicates are rejected; the first commit of the stack is
rejected because it has no parent inside the stack to fold
into.
End-to-end coverage in
crates/mergify-cli/tests/stack_fixup.rs(4 cases): folds Binto A leaving [A, C], dry-run is a no-op, first-commit fixup
is rejected, unknown prefix exits non-zero. The pure
transformer is covered by 3 new
rebase_todounit tests.The pick→fixup transform shares its implementation with a new
generalised
rewrite_replace_verbhelper inrebase_todo—
rewordwill slot into the same shape when that portfollows.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Depends-On: #1517