Skip to content

Add revision headers and description to single-revision diff buffers#60

Open
ArthurHeymans wants to merge 2 commits into
0WD0:mainfrom
ArthurHeymans:CommitMessageDiff
Open

Add revision headers and description to single-revision diff buffers#60
ArthurHeymans wants to merge 2 commits into
0WD0:mainfrom
ArthurHeymans:CommitMessageDiff

Conversation

@ArthurHeymans

@ArthurHeymans ArthurHeymans commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Diff buffers scoped to a single target revision now display revision metadata (commit ID, author, committer, bookmarks, remote bookmarks) and the revision description as collapsible Magit sections before the diff content, mirroring the layout of Magit revision buffers.

Key changes:

  • Added majutsu-insert-diff-revision-headers to render commit metadata (author, committer, dates, refs) as a collapsible commit-headers section
  • Added majutsu-insert-diff-revision-message to render the revision description as a collapsible commit-message section with summary highlighting
  • Added majutsu-diff--message-revision to determine whether the current diff targets a single revision (and thus should show headers/message)
  • Added majutsu-diff--revision-header-fields to fetch and parse revision metadata via a NUL-delimited jj log template, preserving empty fields correctly
  • Added majutsu-diff--format-refs to format local bookmarks and remote bookmarks (excluding the git remote) with appropriate Magit faces
  • Prepended the two new section inserters to majutsu-diff-sections-hook so they appear before the diff
  • Updated both .org and .texi documentation to describe the new behavior

Summary by CodeRabbit

  • New Features

    • Diff buffers now display revision headers and descriptions as collapsible sections before the diff content, while preserving existing diff navigation and editing behavior.
  • Documentation

    • Updated manual to document the new diff buffer layout.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ArthurHeymans, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 59 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 563f5000-dd46-41c7-9926-93f7588407d2

📥 Commits

Reviewing files that changed from the base of the PR and between a901785 and 0d3c750.

📒 Files selected for processing (3)
  • docs/majutsu.org
  • docs/majutsu.texi
  • majutsu-diff.el

Walkthrough

This PR adds revision metadata display to diff buffers showing a single target revision. The hook is updated to prepend two new sections—revision headers and revision description—before the diff content. New functions extract revision metadata via jj log queries and render them as collapsible Magit sections. Documentation is updated to reflect the new layout.

Changes

Revision Metadata in Diff Buffers

Layer / File(s) Summary
Diff sections hook orchestration
majutsu-diff.el
The majutsu-diff-sections-hook now installs majutsu-insert-diff-revision-headers and majutsu-insert-diff-revision-message before the existing majutsu-insert-diff insertion.
Revision headers extraction and formatting
majutsu-diff.el
New majutsu-insert-diff-revision-headers function fetches revision bookmarks, commit ID, author, and committer metadata via jj log templating, parses fields into propertized ref labels, and inserts formatted metadata into a Magit commit-headers section.
Revision description rendering
majutsu-diff.el
New majutsu-insert-diff-revision-message function fetches the revision description text via jj log, inserts it into a Magit commit-message section with revision-summary face, and shows "(no description)" when the message is empty.
Documentation updates
docs/majutsu.org, docs/majutsu.texi
Both documentation files are updated in the Diffing section to describe the new layout where revision headers and collapsible revision description sections appear before the diff content.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A diff now wears its author's face,
Headers and messages in their place,
Before the hunks and files we see,
Revision context, clear and free!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically summarizes the main change: adding revision headers and description to single-revision diff buffers, which aligns with all file modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
majutsu-diff.el (1)

578-620: 🏗️ Heavy lift

Redundant jj log subprocess spawns on every refresh.

These two hook inserters each re-run majutsu-diff--message-revision (one jj log just to count), and then majutsu-insert-diff-revision-headers runs majutsu-diff--revision-header-fields (another jj log) while majutsu-insert-diff-revision-message runs a third for the description. That is ~4 jj log invocations per diff refresh on a common path, where the count, header fields, and description could be retrieved in a single templated query.

Consider resolving the target revision once and fetching the description together with the header fields (the template already collects metadata; add description and reuse it), then sharing the parsed result between both sections.

Want me to draft a consolidated helper that performs a single jj log query and feeds both section inserters?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@majutsu-diff.el` around lines 578 - 620, majutsu-insert-diff-revision-headers
and majutsu-insert-diff-revision-message each call
majutsu-diff--message-revision and re-run jj log separately; implement a single
helper (e.g., majutsu-diff--revision-data) that resolves the target revision
once, runs one templated "jj log -r <rev> -T ..." to emit commit-id,
author-name, author-email, author-date, committer-name, committer-email,
committer-date and description, parses those into a plist or alist, and then
have both majutsu-insert-diff-revision-headers and
majutsu-insert-diff-revision-message call this helper (and stop calling
majutsu-diff--revision-header-fields or re-invoking jj) so headers and message
reuse the same parsed result.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@majutsu-diff.el`:
- Around line 578-620: majutsu-insert-diff-revision-headers and
majutsu-insert-diff-revision-message each call majutsu-diff--message-revision
and re-run jj log separately; implement a single helper (e.g.,
majutsu-diff--revision-data) that resolves the target revision once, runs one
templated "jj log -r <rev> -T ..." to emit commit-id, author-name, author-email,
author-date, committer-name, committer-email, committer-date and description,
parses those into a plist or alist, and then have both
majutsu-insert-diff-revision-headers and majutsu-insert-diff-revision-message
call this helper (and stop calling majutsu-diff--revision-header-fields or
re-invoking jj) so headers and message reuse the same parsed result.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 69cb57be-4543-4817-a9d4-22d94276e898

📥 Commits

Reviewing files that changed from the base of the PR and between 5d1de14 and a901785.

📒 Files selected for processing (3)
  • docs/majutsu.org
  • docs/majutsu.texi
  • majutsu-diff.el

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.

1 participant