fix: retarget PR to master when parent PR has been landed#110
Open
edmondop wants to merge 6 commits intoLucioFranco:mainfrom
Open
fix: retarget PR to master when parent PR has been landed#110edmondop wants to merge 6 commits intoLucioFranco:mainfrom
edmondop wants to merge 6 commits intoLucioFranco:mainfrom
Conversation
* fix: include error source chain in error messages
octocrab's Error::GitHub variant uses snafu without a custom display
attribute, so its Display impl outputs just "GitHub" — the variant name.
The actual API error message lives in the source field but was never
surfaced because From<E> only used format!("{}", error).
Walk std::error::Error::source() chain so wrapped errors include the
underlying message. Also add context to the merge call in land.rs with
PR number and head SHA for better diagnostics.
Before: 🛑 GitHub
After: 🛑 GitHub: <actual reason from GitHub API>
* trigger CI
* style: cargo fmt
* Adding dry run mode * Improve dry run output formatting Show richer details (base/head branches, draft status, reviewers) and suppress commit title output during dry run mode. * trigger CI * style: cargo fmt
* Add jj spr cleanup command List and delete orphan SPR branches on the remote that are no longer associated with any open pull request. Dry-run by default; pass --confirm to actually delete. Extract branch filtering logic into testable functions with unit tests. * trigger CI * style: cargo fmt
After the bottom of a stack is landed and the remaining stack is rebased onto master, jj spr diff now detects that the next PR's commit is directly on master and retargets the PR from its synthetic base to master. The old synthetic base branch is deleted as part of cleanup. Previously, diff would always keep an existing synthetic base even when the commit was rebased directly onto master, leaving the PR targeting a stale synthetic branch. Extract determine_base_branch() for testability.
58b498d to
798f349
Compare
Collaborator
|
Nice! I noticed this the other day and could have sworn it was supposed to already do this. |
Collaborator
Contributor
Author
|
Thank you, this is actually something that I had fixed on my fork, and I forgot to update the PR! Let me update the PR |
Deleting the synthetic base branch before retargeting the PR to master causes GitHub to close the PR, since its base branch no longer exists. Remove the deletion entirely — orphan branches can be cleaned up via `jj spr cleanup` instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Should be fixed with 4068da5 |
Collaborator
Contributor
Author
|
I have never faced this issue can you try to find out how you got there?
Happy to fix it once I have a repel
…On Mon, Mar 30, 2026 at 11:28 AM Stephen Jennings ***@***.***> wrote:
*jennings* left a comment (LucioFranco/jj-spr#110)
<#110?email_source=notifications&email_token=AAGGOKMD2IL5ITI6N7SUMD34TKHAVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJVGU4TENZSGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4155927208>
I've played with the new version and it worked at least once, but today
this happened:
$ jj spr diff
# oops, that should have been cherry picked.
$ jj spr diff --cherry-pick
This is what the PR says:
image.png (view on web)
<https://github.com/user-attachments/assets/bbdaccf0-8f9e-4ba3-b504-2bdba94d4094>
The "deleted the branch main" is alarming. It didn't actually get deleted
because it's protected.
If you don't fix it first, I hope to find time to fix it myself because I
really like this feature.
—
Reply to this email directly, view it on GitHub
<#110?email_source=notifications&email_token=AAGGOKMD2IL5ITI6N7SUMD34TKHAVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJVGU4TENZSGA4KM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2LK4DSL5RW63LNMVXHIX3POBSW4X3DNRUWG2Y#issuecomment-4155927208>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGGOKOSJELEDPNAEGB27AD4TKHAVAVCNFSM6AAAAACWF34CQKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCNJVHEZDOMRQHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.


Summary
jj spr diffnow retargets the new bottom PR from its synthetic base branch to masterdetermine_base_branch()function for testabilityPreviously, after landing PR #1 in a stack and rebasing PR #2 onto master, running
jj spr diffwould keep PR #2 targeting the old synthetic base branch. GitHub would then show the full diff (including already-landed changes) instead of just PR #2's changes.Test plan
cargo test— all tests passcargo clippy --all-features --all-targets -- -D warnings— cleanjj spr diff, verify PR is retargeted to master