Skip to content

refactor(stack): add rebase helpers for squash and fixup#1264

Merged
mergify[bot] merged 1 commit intomainfrom
devs/jd/worktree-squash/add-rebase-helpers-squash-fixup--560beaa3
Apr 21, 2026
Merged

refactor(stack): add rebase helpers for squash and fixup#1264
mergify[bot] merged 1 commit intomainfrom
devs/jd/worktree-squash/add-rebase-helpers-squash-fixup--560beaa3

Conversation

@jd
Copy link
Copy Markdown
Member

@jd jd commented Apr 20, 2026

Adds two helpers to mergify_cli/stack/reorder.py, used by the new
squash and fixup commands:

  • run_action_rebase reorders picks to a desired sha order (same as
    run_rebase) and additionally rewrites pick -> squash|fixup for shas
    listed in actions. An optional exec_after_sha + exec_command pair
    inserts an "exec " line right after the named sha's row — used
    by squash to amend the combined commit's message while HEAD still
    points at it.
  • display_action_plan prints the plan tagged with each commit's action.

run_rebase now delegates to run_action_rebase with an empty actions
dict to avoid duplicating the embedded rebase-todo rewrite script.

No user-facing behavior change — preparation for the fixup and squash
commands.

Copilot AI review requested due to automatic review settings April 20, 2026 13:41
@mergify mergify Bot had a problem deploying to Mergify Merge Protections April 20, 2026 13:41 Failure
@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 20, 2026

This pull request is part of a Mergify stack:

# Pull Request Link
1 refactor(stack): add rebase helpers for squash and fixup #1264 👈
2 feat(stack): add mergify stack fixup command #1265
3 feat(stack): add mergify stack squash command #1266

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 20, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 🤖 Continuous Integration

Wonderful, this rule succeeded.
  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

Wonderful, this rule succeeded.
  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?:

🟢 🔎 Reviews

Wonderful, this rule succeeded.
  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

Wonderful, this rule succeeded.
  • body ~= (?ms:.{48,})

@mergify mergify Bot requested a review from a team April 20, 2026 13:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds helper functions to support upcoming stack squash/fixup functionality by enabling action-aware interactive rebases and action-tagged plan display.

Changes:

  • Introduces run_action_rebase() to reorder commits and rewrite rebase-todo actions (pick → squash/fixup) with optional exec insertion.
  • Introduces display_action_plan() to print a commit plan annotated with each commit’s intended action.
  • Minor docstring formatting adjustment in run_scripted_rebase().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mergify_cli/stack/reorder.py
Comment thread mergify_cli/stack/reorder.py
Comment thread mergify_cli/stack/reorder.py
Comment thread mergify_cli/stack/reorder.py
Comment thread mergify_cli/stack/reorder.py
@jd jd marked this pull request as ready for review April 20, 2026 13:46
Adds two helpers to mergify_cli/stack/reorder.py, used by the new
squash and fixup commands:

- run_action_rebase reorders picks to a desired sha order (same as
  run_rebase) and additionally rewrites pick -> squash|fixup for shas
  listed in actions. An optional exec_after_sha + exec_command pair
  inserts an "exec <cmd>" line right after the named sha's row — used
  by squash to amend the combined commit's message while HEAD still
  points at it.
- display_action_plan prints the plan tagged with each commit's action.

run_rebase now delegates to run_action_rebase with an empty actions
dict to avoid duplicating the embedded rebase-todo rewrite script.

No user-facing behavior change — preparation for the fixup and squash
commands.

Change-Id: I560beaa3ed28ee211f601d15e550411fbe8107c4
@jd jd force-pushed the devs/jd/worktree-squash/add-rebase-helpers-squash-fixup--560beaa3 branch from eada573 to 80b8633 Compare April 20, 2026 14:08
@jd
Copy link
Copy Markdown
Member Author

jd commented Apr 20, 2026

Revision history

# Type Changes Date
1 initial eada573 2026-04-20 14:08 UTC
2 content eada573 → 80b8633 2026-04-20 14:08 UTC

@mergify mergify Bot deployed to Mergify Merge Protections April 20, 2026 14:08 Active
@mergify mergify Bot requested a review from a team April 21, 2026 07:16
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 21, 2026

Merge Queue Status

This pull request spent 5 minutes 55 seconds in the queue, including 5 minutes 27 seconds running CI.

Required conditions to merge

mergify Bot added a commit that referenced this pull request Apr 21, 2026
@mergify mergify Bot added the queued label Apr 21, 2026
mergify Bot added a commit that referenced this pull request Apr 21, 2026
@mergify mergify Bot merged commit 477fde5 into main Apr 21, 2026
19 checks passed
@mergify mergify Bot deleted the devs/jd/worktree-squash/add-rebase-helpers-squash-fixup--560beaa3 branch April 21, 2026 07:43
@mergify mergify Bot removed the queued label Apr 21, 2026
mergify Bot pushed a commit that referenced this pull request Apr 21, 2026
Add "mergify stack fixup COMMIT..." which folds each listed commit into
its parent inside the stack (dropping its message) without opening an
editor. Multiple commits can be listed: each folds into its own parent.

Errors when a listed commit is first-in-stack, unknown, or duplicated.
Supports --dry-run.

Depends-On: #1264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants