Skip to content

Commit 992bff3

Browse files
jdclaude
andcommitted
feat(stack): add revision history comments for force-pushed PRs
When `stack push` force-pushes a PR branch, reviewers have no way to see what changed between the previous and new commits. This adds a "Revision History" comment on each updated PR showing all push iterations with: - Compare links (github.com/owner/repo/compare/old...new) so reviewers can see exactly what changed - Change type labels (content vs rebase) using git patch-id to detect whether the force-push changed actual code or just rebased - Timestamps for each push iteration The feature is enabled by default. Disable per-push with `--no-revision-history` or globally with: git config --global mergify-cli.stack-revision-history false Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Change-Id: Id77b800246f8ba19cebedb75ca9913a790abcc25
1 parent f5e13b6 commit 992bff3

5 files changed

Lines changed: 904 additions & 28 deletions

File tree

mergify_cli/stack/cli.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,15 @@ async def new(
341341
is_flag=True,
342342
help="Only update existing pull requests, do not create new ones",
343343
)
344+
@click.option(
345+
"--no-revision-history",
346+
is_flag=True,
347+
flag_value=True,
348+
default=lambda: not asyncio.run(utils.get_default_revision_history()),
349+
help="Don't post revision history comments on pull requests. "
350+
"Default fetched from git config if added with "
351+
"`git config --add mergify-cli.stack-revision-history false`",
352+
)
344353
@utils.run_with_asyncio
345354
async def push(
346355
ctx: click.Context,
@@ -356,6 +365,7 @@ async def push(
356365
trunk: tuple[str, str],
357366
branch_prefix: str | None,
358367
only_update_existing_pulls: bool,
368+
no_revision_history: bool,
359369
) -> None:
360370
if setup:
361371
# backward compat
@@ -378,6 +388,7 @@ async def push(
378388
keep_pull_request_title_and_body=keep_pull_request_title_and_body,
379389
only_update_existing_pulls=only_update_existing_pulls,
380390
author=author,
391+
revision_history=not no_revision_history,
381392
)
382393

383394

0 commit comments

Comments
 (0)