feat: muse#54 item 1 — relative time syntax for @{...} reflog refs
Extends resolve_reflog_ref() to accept relative-time specs alongside the existing @{N} integer-index form:
- @{N.unit.ago} — unit is second/minute/hour/day/week, singular or plural (e.g. "1.hour.ago", "2.days.ago"). - @{yesterday} — start of today (UTC midnight), i.e. "most recent entry before midnight last night".
Both forms resolve to the most recent entry at or before the computed cutoff, scoped to HEAD or a named branch log exactly like the existing @{N} / branch@{N} forms. The @{N} regex was broadened from a digits-only capture to a generic "anything inside the braces" capture, then disambiguated inside resolve_reflog_ref: digit-only -> index path (unchanged behavior), otherwise -> time-spec path. Unrecognized specs and specs where no entry is old enough both return None, same contract as "spec doesn't match the @{N} pattern" — callers (rev-parse, checkout, diff, resolve_commit_ref) already treat a None/exception result as "try the next resolution strategy," so no caller changes were needed.
Covered by tests/test_reflog_time_resolution.py (8 cases: hour-ago cutoff selection, minutes-ago, yesterday, no-entry-old-enough, named-branch time spec, unrecognized spec, non-regression of the plain @{N} index form, and a `muse rev-parse` CLI integration test). Confirmed genuine RED by reverting the fix file and re-running (5 of 8 failed — the time-spec-specific cases — while the 3 unaffected-behavior cases passed incidentally), then GREEN with the fix restored. Ran the full targeted regression suite (346 tests across every reflog/rev-parse/ checkout test file) with zero regressions. Live-verified via muse-dev against a disposable /tmp sandbox (0.second.ago, yesterday, and 1.week.ago with no qualifying entry).
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Semantic Changes
39 symbols
Files Changed
+1
~2
1228 in snapshot
0 comments
muse hub commit comment sha256:2d36521a1c0daf8222df46cff206eb4d8a12b8f22bc71dfa5d7011c5e47ad169 --body "your comment"
No comments yet. Be the first to start the discussion.