Repository navigation
ghusage 0.1.5
Lines changed by commits and pull requests
ghusage now reports how many lines your commits added and deleted, and each pull request's current diff (#8).
- Reports:
overviewshows Lines changed (your commits).daily,weekly,monthly,yearlyandreposgain+Linesand-Linescolumns, in tables, Markdown and CSV. JSON summaries gaindiff_stats. - Pull requests:
prsgains a Changes column andpra Changes (current snapshot) line, showing the base-to-head diff when the pull request was last synced. In JSON this isdiff. It is a snapshot of the pull request, not changes made in the period, and it is never added to the commit totals. - Terminal UI: line counts on the Overview, Daily and Repositories screens, PR Detail, and the pull request commit list.
- Fetching:
- Line counts of pull request commits and pull request diffs come with the pull request query, at no extra request.
ghusage sync --diff-statsfetches the line counts still missing for your other commits in the period, 100 commits per GraphQL request, in parallel. About 1,100 commits took about 12 requests.- Counts already stored are never fetched again.
- Honest totals:
- Unknown line counts are never treated as zero. A sum over only some commits is marked (
~in tables,coverage: "partial"in JSON), and one with no known counts shows?. - Merge commits are left out of the totals, because GitHub reports them against their first parent.
- Commits whose changes reach the default branch as other commits are left out too, so the same change is not counted twice. These are commits that exist only in pull requests merged by squash or rebase, and commits removed by a force push. How many were left out is reported. This rule is provisional.
- Unknown line counts are never treated as zero. A sum over only some commits is marked (
Line counts are easily dominated by generated files, formatting and dependency updates. They describe what changed, not how much or how well anyone worked. See Lines changed.
Cache: the cache schema moves to version 3. A cache opened by 0.1.5 cannot be read by older versions. Pull requests synced before this version have no recorded merge method, so their commits are left out of line totals until you run ghusage sync --full for the period.
Performance
Incremental syncs are about 2.4 times faster. Measured with the published 0.1.4 and 0.1.5 on the same account (sync --since 30d, Apple M4, versions alternating with 90 s pauses):
| 0.1.4 | 0.1.5 | |
|---|---|---|
| Incremental sync (mean of runs) | 14.8 s | 6.2 s |
| Requests per incremental sync | 45–47 | 46–47 |
The number of requests is unchanged; the time saved comes from running them at the same time:
- Search pages and REST pages beyond the first are fetched in parallel, since the first page tells how many there are.
- Commit search and the repository list start together with the pull request search.
- A search page that GitHub reports as incomplete (its search timed out) is fetched again before the range is reported as partial.
A first sync of an empty cache is not faster: it is bound by GitHub's search rate limit (30 requests per minute). Cached reports are as fast as in 0.1.4 (cached 7-day aggregation p95 85 ms, 30-day 118 ms on Apple M4 with 100,000 events).
Sync progress
While a sync runs in a terminal, the progress now shows how many requests run in parallel out of --concurrency, how many have finished, and up to four of the requests in flight with how long each has been running.
Other changes
- Documentation site: sitemap,
robots.txt, canonical URLs, Open Graph tags, and links between the English and Japanese pages. - Issue forms and a pull request template.
- The documentation now gives the correct default for
--concurrency(8).
Install / update
npm install -g ghusage@0.1.5Full changelog: v0.1.4...v0.1.5