refactor(log): split graph renderer and date formatting out of log.mbt#136
Merged
Conversation
log.mbt had grown to ~7.6k lines. Extract two cohesive, self-contained clusters into sibling files in the same package (no visibility changes): - log_graph.mbt: the `--graph` renderer (GitGraph state machine, a faithful port of git's graph.c). Driven by log_emit_commit_graph, which stays in log.mbt. - log_datefmt.mbt: pure timestamp/calendar helpers (epoch<->calendar, timezone offset parsing, git date output modes). Pure code motion; behavior is unchanged. `moon check --target native` passes with 0 errors and moonc codegen succeeds. log.mbt drops from 7586 to 6732 lines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHFC6qxKjqjrixgjFtGihM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cmd/bit/log.mbthad grown to 7586 lines. This splits two cohesive, self-contained clusters into their own files within the same package (no visibility or import changes — MoonBit packages span all.mbtfiles in a directory). Pure code motion; behavior is unchanged.log_graph.mbt(714 lines): the--graphrenderer —GitGraphstruct plus allgraph_*functions, a faithful port of git'sgraph.cstate machine. Driven bylog_emit_commit_graph(still inlog.mbt).log_datefmt.mbt(150 lines): pure timestamp/calendar helpers (epoch↔calendar conversion, timezone offset parsing, the git--dateoutput modes). Theformat_date_by_modedispatcher stays inlog.mbt.log.mbtdrops from 7586 → 6732 lines. Both new files are registered inmoon.pkgas native-only.Verification
moon check --target native: 0 errors (same 221 pre-existing deprecation warnings as baseline)moon build --target native --release: exit 0, linksbit.exevia/usr/bin/ccbit log --graphrenders the merge graph art correctly (log_graph.mbt)bit log --date=rfc2822/--date=isoproduce correct output (log_datefmt.mbt)🤖 Generated with Claude Code
Generated by Claude Code