gabriel / muse public
feat patch feat/54-reflog-diff #1 / 1
AI Agent gabriel · 9 hours ago · Oct 21, 2026 · Diff

feat: muse reflog diff @{N} @{M} (muse#54 item 7)

`muse diff "@{N}" "@{M}"` already worked -- resolve_commit_ref already resolves @{N} specs via the existing reflog machinery, confirmed live before writing any code. The actual gap was convenience: manually constructing the "<branch>@{N}" spec strings for both sides every time.

`muse reflog diff N M [--branch <name>]` is a thin wrapper: builds the two @{N} spec strings (prefixed with the branch name when --branch is given, bare @{N} against the HEAD log otherwise) and delegates directly to muse.cli.commands.diff.run() via a synthetic argparse.Namespace with every other diff flag at its default -- the exact same diff engine `muse diff` uses, not a reimplementation. index_b defaults to 0 (the most recent entry), so `muse reflog diff 2` alone compares @{2} against the current state.

New tests/test_reflog_diff.py (5): diff between two HEAD-log indices shows real changes, the second index defaults to 0, --branch prefixes both ref strings correctly, identical indices report no changes, and an out-of-range index fails cleanly (exit 1, matching resolve_commit_ref's own IndexError handling). Confirmed genuine RED (5/5 failed -- unrecognized "diff" reflog subcommand) before GREEN with the fix restored.

Targeted regression suite -- the new file plus test_cmd_reflog.py, test_cmd_reflog_hardening.py -- all pass (86 passed), zero regressions.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

sha256:2af883aa70af9cec92cf4b5ca9b2574ff23e6f679d9eb4771c6e40d4822152a7 sha
+22 ~4 symbols
3 changed · 1224 in snapshot files
sha256:bbe89929343af3a9f4cdb28fcdca7de2b70d6b471d9fd2c75d7639402eb537db snapshot
+22
symbols added
~4
symbols modified
3
files changed
1224
files in snapshot
0
dead code introduced
Semantic Changes 26 symbols
~ tests/test_reflog_diff.py .py 21 symbols added
+ TestReflogDiff class class TestReflogDiff L52–102
+ test_diff_defaults_second_index_to_zero method method test_diff_defaults_second_index_to_zero L67–75
+ test_diff_identical_indices_has_no_changes method method test_diff_identical_indices_has_no_changes L88–95
+ test_diff_out_of_range_index_errors method method test_diff_out_of_range_index_errors L97–102
+ test_diff_two_head_indices method method test_diff_two_head_indices L53–65
+ test_diff_with_branch_flag method method test_diff_with_branch_flag L77–86
+ _commit_file function function _commit_file L43–49
+ _env function function _env L19–20
+ _init_repo function function _init_repo L27–40
+ _run function function _run L23–24
+ cli variable variable cli L15–15
+ CliRunner import import CliRunner L11–11
+ Manifest import import Manifest L12–12
+ annotations import import annotations L5–5
+ datetime import import datetime L7–7
+ fake_id import import fake_id L12–12
+ json import import json L8–8
+ muse_dir import import muse_dir L13–13
+ pathlib import import pathlib L9–9
+ ref_path import import ref_path L13–13
+ runner variable variable runner L16–16
~ muse/cli/commands/reflog.py .py 1 symbol added, 1 symbol modified
+ run_diff function function run_diff L604–642
Files Changed
+1 ~2
1224 in snapshot
← Older Oldest on feat/54-reflog-diff
All commits
Newer → Latest on feat/54-reflog-diff

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:2af883aa70af9cec92cf4b5ca9b2574ff23e6f679d9eb4771c6e40d4822152a7 --body "your comment"