merge queue: embarking main (d8eaac9) and #1325 together#1335
Closed
mergify[bot] wants to merge 2 commits intomainfrom
Closed
merge queue: embarking main (d8eaac9) and #1325 together#1335mergify[bot] wants to merge 2 commits intomainfrom
mergify[bot] wants to merge 2 commits intomainfrom
Conversation
After a stack push that includes both a rebase onto a moved trunk and content edits, the standard `compare/old_sha...new_sha` URL anchored at `merge-base(old, new)` shows the user's actual changes mixed with every upstream commit pulled in by the rebase. Reviewers see noise instead of intent. This change synthesises a "replay" commit per content-change push: cherry-pick the previous PR head onto the new PR head's parent (via `git merge-tree --write-tree` — no working-tree side effects), upload it as an unreferenced commit through the GitHub Git Data API, and use its SHA as the URL anchor for a clean rebase-aware diff. The visible SHA-shorthand label still shows the actual old/new SHAs so users see what they expect, and a small `(raw)` fallback link points at the original three-dot URL — useful when GitHub eventually GCs the unreferenced replay commit. Pure-rebase pushes (patch-IDs match) skip the synthesis entirely and render a `_(rebase only)_` badge with no link, since the meaningful diff is empty. Failure modes (cherry-pick conflict, missing parents, GitHub API errors, git < 2.38) all return None silently and the renderer falls back to the existing three-dot URL — no behaviour regression. New module `mergify_cli/stack/replay.py`: - compute_merged_tree → runs `git merge-tree --write-tree` with parallel parent rev-parses, returns merged tree SHA + parent_new SHA - compute_tree_delta → parses `git diff-tree -r --raw --no-renames` into Git Data API tree entries, with mode/type preservation for executables, symlinks, and submodules - upload_replay_commit → POSTs the tree delta with `base_tree` then a parentless-of-new commit; returns the new commit SHA or None on any HTTP error - replay_for_revision → top-level orchestration with all-failure-mode fallback to None Wired into `stack_push`: `replay_for_revision` runs concurrently per "content"-classified PR (bounded by the existing MAX_CONCURRENT_API_CALLS semaphore) before the force-push to GitHub. The resulting replay SHA flows through the revision-history comment data path as a new `_RevisionEntry.replay_sha` field, persisted in the JSON marker for round-trip and re-render across subsequent pushes. Tests: 12 new in `test_replay.py` (covering merge-tree clean/conflict, tree-delta parsing for M/A/D/T statuses including submodule mode preservation, two-stage API upload happy and partial-failure paths, end-to-end orchestration including conflict / no-diff / rev-parse-tree short-circuits) plus 5 new in `test_push.py` covering the data-model round-trip, the rebase-only badge, the dual-link rendering with and without replay_sha, and end-to-end propagation through `stack_push`. Change-Id: I4b16130414084031dc79dc3de22fc1ae32334409
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 pull request has been checked successfully and will be merged soon. 🎉
Branch main (d8eaac9) and #1325 are embarked together for merge.
This pull request has been created by Mergify to speculatively check the mergeability of #1325.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.
Required conditions of queue rule
defaultfor merge:title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:#approved-reviews-by>=2author = dependabot[bot]author = mergify-ci-botauthor = renovate[bot]body ~= (?ms:.{48,})#changes-requested-reviews-by = 0#review-requested = 0#review-threads-unresolved = 0check-success=ci-gateRequired conditions to stay in the queue:
base=mainlabel!=manual mergetitle ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?:#approved-reviews-by>=2author = dependabot[bot]author = mergify-ci-botauthor = renovate[bot]body ~= (?ms:.{48,})#changes-requested-reviews-by = 0#review-requested = 0#review-threads-unresolved = 0check-success=ci-gate