Skip to content

feat(jj): parse jj-style conflict markers in parse_conflicts - #308

Merged
dlyongemallo merged 1 commit into
mainfrom
267-jj_style_conflict_markers
Aug 19, 2026
Merged

feat(jj): parse jj-style conflict markers in parse_conflicts#308
dlyongemallo merged 1 commit into
mainfrom
267-jj_style_conflict_markers

Conversation

@dlyongemallo

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR extends M.parse_conflicts in lua/diffview/vcs/utils.lua to recognize Jujutsu (jj) conflict markers in addition to the existing git diff3 markers, so that diffview's marker-based conflict actions (choose ours/base/theirs, navigate conflicts) work in jj repositories using the default ui.conflict-marker-style = "diff" and "snapshot" styles. Previously only git-style markers (including jj's "git" style) were understood.

The implementation adds a self-contained jj sub-parser that is tried before the git state machine, gated by a forward "peek" so that a git conflict whose branch label merely starts with conflict is still handled by the git path. jj regions are projected onto the existing ours/base/theirs model; 3+ sided or otherwise unrepresentable regions are skipped. The existing git parsing path is left behavior-unchanged, and the cursor-tracking logic is refactored into a shared register helper reused by both paths.

Changes:

  • Add jj marker patterns plus looks_like_jj_region (disambiguation peek) and parse_jj_region (assembles a ConflictRegion from %%%%%%%/+++++++/------- sub-blocks), and integrate them into the parse_conflicts loop via a skip_until mechanism.
  • Extract cursor/index bookkeeping into a register helper shared by the git handle path and the new jj path.
  • Add a comprehensive parse_conflicts_spec.lua and update the help doc note to reflect jj marker-style support.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lua/diffview/vcs/utils.lua Adds jj marker patterns, looks_like_jj_region/parse_jj_region, a shared register helper, and loop integration to parse jj conflict regions.
lua/diffview/tests/functional/parse_conflicts_spec.lua New unit tests covering git diff3, jj diff/snapshot styles, N-sided skipping, and mixed back-to-back regions.
doc/diffview.txt Updates the Jujutsu note to state all three marker styles work for 2-sided conflicts and 3+ sided ones are skipped.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@dlyongemallo
dlyongemallo merged commit 3e45bde into main Aug 19, 2026
9 checks passed
@dlyongemallo
dlyongemallo deleted the 267-jj_style_conflict_markers branch August 19, 2026 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants