feat: add multi-commit PR support via local branches/bookmarks#2
Open
jucor wants to merge 6 commits into
Open
Conversation
When spr detects a jj-colocated repo (.jj/ directory present), it uses jj commands for history-rewriting operations instead of git rebase. This preserves jj change IDs across spr update/merge/amend/edit cycles. Key changes: - New vcs/ package with VCSOperations interface abstracting the 7 operations where git and jj differ (FetchAndRebase, GetLocalCommitStack, AmendInto, EditStart/Finish/Abort, PrepareForPush) - GitOps: pure extraction of existing git logic (no behavior change) - JjOps: jj-native implementation using jj describe, jj rebase, jj squash, jj edit (preserves change IDs) - Auto-detection: .jj/ directory triggers jj mode - Opt-out: --no-jj flag, SPR_NOJJ env var, or noJJ: true in ~/.spr.yml - 31 new tests, all existing tests pass unchanged Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GetInfo previously called git.GetLocalCommitStack internally, bypassing the VCSOperations abstraction. In jj mode this panicked because git rebase cannot add commit-id trailers to jj commits. Now all callers provide commits via vcsOps.GetLocalCommitStack, and GetInfo receives them as a parameter. Also adds CheckStackCompleteness to warn when @ has descendants in jj mode (commits above @ would be excluded from trunk()..@), prompting for confirmation before proceeding. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JjCmd.Jj() uses strings.Fields to split args, which breaks template strings containing spaces (e.g. -T 'commit_id ++ ...'). Switch to JjArgs which passes pre-split arguments directly to exec.Command, bypassing shell quoting entirely. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Removed JJ_CONFIG= from jj command execution. Setting this env var to empty caused jj to skip loading user config, resulting in empty committer name/email on every rebase and describe operation.
Add optional multi-commit PR mode where local git branches or jj bookmarks define PR boundaries. Each branch/bookmark on the linear history from trunk to HEAD marks the tip of a PR group. Commits above the last branch are treated as WIP. Key changes: - Config: multiCommitPRs and concatCommitMessages settings - Commit struct: new Branches field for branch/bookmark annotations - Git: detect local branches on commits, auto-update branch positions after spr's own rebase using commit-id trailer matching - JJ: parse bookmarks from extended jj log template - Grouping: new PRGroup type and GroupCommitsIntoPRs() function - spr.go: Update/Merge/Status flows use tip commits from groups - Templates: support spr-pr-title:/spr-pr-body: markers in tip commit, concatenate commit messages in PR body (configurable) - All existing tests pass, new tests for grouping, parsing, templates https://claude.ai/code/session_01PDskCvL2BSTTEwKRucykbh
ef2d8fd to
3e041d5
Compare
7f657d8 to
b3946a1
Compare
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.
Add optional multi-commit PR mode where local git branches or jj bookmarks define PR boundaries. Each branch/bookmark on the linear history from trunk to HEAD marks the tip of a PR group. Commits above the last branch are treated as WIP.
Key changes:
https://claude.ai/code/session_01PDskCvL2BSTTEwKRucykbh