Skip to main content

Pretty-print `git` repository collaborators sorted by contributions

Project description

PyPI-Status PyPI-Versions

Build-Status Coverage-Status Branch-Coverage-Status Codacy-Grade

LICENCE

Pretty-print git repository collaborators sorted by contributions.

~$ git fame
Blame: 100%|███████████████████████████████████| 11/11 [00:00<00:00, 208.43it/s]
Total commits: 302
Total files: 37
Total loc: 3134
+----------------------+------+------+------+----------------+
| Author               |  loc | coms | fils |  distribution  |
+======================+======+======+======+================+
| Casper da Costa-Luis | 3123 |  297 |   35 | 99.6/98.3/85.4 |
| Not Committed Yet    |    7 |    4 |    2 |  0.2/ 1.3/ 4.9 |
| Evïan Etàcidñys      |    4 |    1 |    1 |  0.1/ 0.3/ 2.4 |
+----------------------+------+------+------+----------------+

The distribution column is a percentage breakdown of the other columns (e.g. in the table above, Casper has written surviving code in 35/37 = 85.4% of all files)


Installation

Latest PyPI stable release

PyPI-Status

pip install git-fame

Latest development release on github

GitHub-Status

Pull and install in the current directory:

pip install -e git+https://github.com/casperdcl/git-fame.git@master#egg=git-fame

Register alias with git

This is probably not necessary on UNIX systems.

git config --global alias.fame "!python -m gitfame"

Tab completion

Optionally, systems with bash-completion can install tab completion support. The git-fame_completion.bash file needs to be copied to an appropriate folder.

On Ubuntu, the procedure would be:

$ # Ensure completion works for `git` itself
$ sudo apt-get install bash-completion

$ # Install `git fame` completions
$ sudo cp git-fame_completion.bash /etc/bash_completion.d/

followed by a terminal restart.

Usage

git fame              # If alias registered with git (see above)
git-fame              # Alternative execution as python console script
python -m gitfame     # Alternative execution as python module
git-fame -h           # Print help

For example, to print statistics regarding all source files in a C++/CUDA repository (*.c/h/t(pp), *.cu(h)), carefully handling whitespace and line copies:

git fame --incl '\.[cht][puh]{0,2}$' -twMC

It is also possible to run from within a python shell or script.

>>> import gitfame
>>> import sys
>>> sys.argv = ['', '--sort=commits', '-wt', './path/to/my/repo']
>>> gitfame.main()

Documentation

Usage:
  gitfame [--help | options] [<gitdir>]

Options:
  -h, --help     Print this help and exit.
  -v, --version  Print module version and exit.
  --sort=<key>    Options: [default: loc], files, commits.
  --excl=<f>      Excluded files [default: None].
                  In no-regex mode, may be a comma-separated list.
                  Escape (\,) for a literal comma (may require \\, in shell).
  --incl=<f>      Included files [default: .*]. See `--excl` for format.
  -n, --no-regex  Assume <f> are comma-separated exact matches
                  rather than regular expressions [default: False].
                  NB: if regex is enabled `,` is equivalent to `|`.
  -s, --silent-progress    Suppress `git-fame` [default: False].
  -t, --bytype             Show stats per file extension [default: False].
  -w, --ignore-whitespace  Ignore whitespace when comparing the parent's
                           version and the child's to find where the lines
                           came from [default: False].
  -M              Detect intra-file line moves and copies [default: False].
  -C              Detect inter-file line moves and copies [default: False].

Arguments:
  <gitdir>       Git directory [default: ./].

Licence

Open Source (OSI approved): LICENCE

Copyright (c) 2016 Casper da Costa-Luis.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

Authors

Hits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

git-fame-1.2.0.zip (19.3 kB view hashes)

Uploaded Source

git-fame-1.2.0.tar.gz (10.8 kB view hashes)

Uploaded Source

Built Distributions

git_fame-1.2.0-py2.py3-none-any.whl (13.3 kB view hashes)

Uploaded Python 2 Python 3

git-fame-1.2.0.win-amd64.exe (279.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page