A tool for counting cumulative changes per author for Git repositories. Can output text, CSV, or LaTeX.
This program sums the output from git show --numstat
to get actual number of
inserted/removed lines, unlike other line counting tools which use --stat
to
estimate line counts (good luck with that, lol).
python countlines.py <path-to-repo> --by=name --output=tex > stats.tex
xelatex stats.tex
Note: <path-to-repo>
can be a directory on the filesystem with a checked-out repository,
or it can be a git repository url. In the latter case, the code will be cloned to the local repo
directory (unless the directory already exists).
An alias file can be used to map email addresses to names. This is handy when one or more authors have been inconsistent in their use of the author field in their commits.
- Generate an initial alias file:
python countlines.py <path-to-repo> --output=alias > aliasfile
- Edit
aliasfile
python countlines.py <path-to-repo> --alias=aliasfile --by=name --output=csv > stats.csv
Output can be written as a TeX file to produce pretty tables for articles etc. Here is an example of the TeX output:
This table was generated with the following commands:
./countlines.py https://bitbucket.org/extendj/extendj --alias=aliases --by=name --output=tex --limit=6 > example.tex
xelatex example.tex
convert -background White -layers flatten -density 120 -antialias example.pdf example-table.png