gabriel / muse public
feat patch dev
gabriel · 166 days ago · Apr 14, 2026 · Diff

feat: implement muse rev-list — raw commit ID stream with filters

Closes staging issue #11.

New command: muse rev-list [<ref>|<A>..<B>] [flags]

Flags: --count emit single integer (O(1) memory — counter, no list) -n / --max-count short-circuit walk after N matches --first-parent linear chain only, skip merge parents --no-merges exclude merge commits --merges only merge commits --author PATTERN regex/substring filter on author --after DATE commits after YYYY-MM-DD (UTC) --before DATE commits before YYYY-MM-DD (UTC) --touches PATH commits that changed PATH (prefix-matched, manifest cache) --reverse oldest-first output --json {"commit_ids": [...]} envelope

Range syntax: A..B emits commits reachable from B not from A. _walk_from uses deque (O(1) popleft/appendleft). _commit_touches_path uses per-invocation manifest cache (same pattern as log.py). --touches path validated against traversal sequences before any I/O.

Tests: 26 passing — unit (AST deque check, _parse_range, _parse_date), integration (all flags, range syntax, filters), security (traversal, ref injection, bad regex), stress (500-commit --count flat memory, 50-commit touches)

sha256:b0f78cddeee7edb8e5cf6fc9df7959d1ede1a3b607cc9c35c1ae58205430403e sha
+74 ~25 symbols
sha256:a80bc06b31fb985be89d1cf32a277251caeed4c7ef6551a448238ad3dd0f146d snapshot
+74
symbols added
~25
symbols modified
0
dead code introduced
Semantic Changes 99 symbols
~ muse/cli/commands/rev_list.py .py 33 symbols added
+ _ManifestCache variable variable _ManifestCache L78–78
+ _Predicate variable variable _Predicate L79–79
+ _commit_touches_path function function _commit_touches_path L154–183
+ _exclude_set function function _exclude_set L186–215
+ _get_manifest function function _get_manifest L128–151
+ _parse_date function function _parse_date L104–125
+ _parse_range function function _parse_range L86–101
+ _walk_from function function _walk_from L218–287
+ Callable import import Callable L56–56
+ CommitRecord import import CommitRecord L61–61
+ ExitCode import import ExitCode L59–59
+ Manifest import import Manifest L69–69
+ annotations import import annotations L46–46
+ argparse import import argparse L48–48
+ datetime import import datetime L49–49
+ deque import import deque L55–55
+ get_commit_snapshot_manifest import import get_commit_snapshot_manifest L61–61
+ get_head_commit_id import import get_head_commit_id L61–61
+ get_limit import import get_limit L58–58
+ json import import json L50–50
+ logging import import logging L51–51
+ pathlib import import pathlib L52–52
+ re import import re L53–53
+ read_commit import import read_commit L61–61
+ read_current_branch import import read_current_branch L61–61
+ read_repo_id import import read_repo_id L60–60
+ require_repo import import require_repo L60–60
+ resolve_commit_ref import import resolve_commit_ref L61–61
+ sanitize_display import import sanitize_display L70–70
+ sys import import sys L54–54
+ logger variable variable logger L72–72
+ register function function register L295–382
+ run function function run L390–580
~ tests/test_cmd_rev_list.py .py 40 symbols added
+ _commit function function _commit L51–69
+ _fresh_repo function function _fresh_repo L72–80
+ _init function function _init L40–48
+ _invoke function function _invoke L30–37
+ _make_merge_commit function function _make_merge_commit L204–217
+ cli_main function function cli_main L429–431
+ CliRunner import import CliRunner L20–20
+ InvokeResult import import InvokeResult L20–20
+ annotations import import annotations L12–12
+ json import import json L14–14
+ os import import os L15–15
+ pathlib import import pathlib L16–16
+ pytest import import pytest L18–18
+ runner variable variable runner L22–22
+ test_parse_date_invalid_raises function function test_parse_date_invalid_raises L134–137
+ test_parse_date_valid function function test_parse_date_valid L124–131
+ test_parse_range_dotdot function function test_parse_range_dotdot L108–113
+ test_parse_range_single function function test_parse_range_single L116–121
+ test_rev_list_after_filter function function test_rev_list_after_filter L253–263
+ test_rev_list_author_filter function function test_rev_list_author_filter L241–250
+ test_rev_list_author_regex_special_chars_handled function function test_rev_list_author_regex_special_chars_handled L385–390
+ test_rev_list_before_filter function function test_rev_list_before_filter L266–273
+ test_rev_list_count function function test_rev_list_count L166–170
+ test_rev_list_count_flat_memory_large_chain function function test_rev_list_count_flat_memory_large_chain L405–426
+ test_rev_list_emits_one_id_per_line function function test_rev_list_emits_one_id_per_line L145–154
+ test_rev_list_first_parent function function test_rev_list_first_parent L355–371
+ test_rev_list_json function function test_rev_list_json L189–196
+ test_rev_list_max_count function function test_rev_list_max_count L173–178
+ test_rev_list_merges_only function function test_rev_list_merges_only L232–238
+ test_rev_list_newest_first function function test_rev_list_newest_first L157–163
+ test_rev_list_no_merges function function test_rev_list_no_merges L220–229
+ test_rev_list_range_count function function test_rev_list_range_count L333–347
+ test_rev_list_range_syntax function function test_rev_list_range_syntax L308–330
+ test_rev_list_ref_not_found_exits_nonzero function function test_rev_list_ref_not_found_exits_nonzero L379–382
+ test_rev_list_reverse function function test_rev_list_reverse L181–186
+ test_rev_list_stress_touches_large_repo function function test_rev_list_stress_touches_large_repo L434–451
+ test_rev_list_touches_directory_prefix function function test_rev_list_touches_directory_prefix L289–300
+ test_rev_list_touches_filter function function test_rev_list_touches_filter L276–286
+ test_rev_list_touches_path_traversal_rejected function function test_rev_list_touches_path_traversal_rejected L393–397
+ test_walk_from_uses_deque function function test_walk_from_uses_deque L88–105
← Older Oldest on dev
All commits
Newer → Latest on dev

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:b0f78cddeee7edb8e5cf6fc9df7959d1ede1a3b607cc9c35c1ae58205430403e --body "your comment"