按贡献排序的漂亮打印“git”存储库协作者
git-fame的Python项目详细描述
漂亮的打印git按贡献排序的存储库协作者。
~$ git fame Blame: 100%|██████████|20/20 [00:00<00:00, 175.94file/s] Total commits: 99 Total files: 21 Total loc: 305| Author | loc | coms | fils | distribution ||:---------------------|------:|-------:|-------:|:----------------|| Casper da Costa-Luis |304|97|20|99.7/98.0/95.2 || Igor Gnatenko |1|1|1|0.3/ 1.0/ 4.8 || Johann Mortara |0|1|0|0.0/ 1.0/ 0.0 |
distribution列是其他列的百分比细分 (例如,在上表中,casper在 20/21 = 95.2%所有文件)。
目录
Installation
Latest development release on GitHub
在当前目录中拉入并安装:
pip install -e git+https://github.com/casperdcl/git-fame.git@master#egg=git-fame
Latest Docker release
docker pull casperdcl/git-fame docker run --rm casperdcl/git-fame --help docker run --rm -v </local/path/to/repository>:/repo casperdcl/git-fame
Tab completion
可选地,具有bash-completion的系统可以安装tab completion 支持。这个 git-fame_completion.bash 需要将文件复制到适当的文件夹中。
在ubuntu上,程序是:
$ # Ensure completion works for `git` itself $ sudo apt-get install bash-completion $ # Install `git fame` completions $ sudo wget \ https://raw.githubusercontent.com/casperdcl/git-fame/master/git-fame_completion.bash \ -O /etc/bash_completion.d/git-fame_completion.bash
然后是终端重启
Changelog
所有更改的列表可在GitHub的版本中找到:
或爬虫程序,如
allmychanges.com。
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
例如,在C++/CUDA中打印关于所有源文件的统计信息 存储库(*.c/h/t(pp), *.cu(h)),仔细处理空白和行 副本:
git fame --incl '\.[cht][puh]{0,2}$' -twMC
也可以从python shell或脚本中运行。
>>>importgitfame>>>gitfame.main(['--sort=commits','-wt','/path/to/my/repo'])
Documentation
Usage: gitfame [--help | options] [<gitdir>] Arguments: <gitdir> Git directory [default: ./]. Options: -h, --help Print this help and exit. -v, --version Print module version and exit. --branch=<b> Branch or tag [default: HEAD] up to which to check. --sort=<key> [default: loc]|commits|files|hours|months. --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. --since=<date> Date from which to check. Can be absoulte (eg: 1970-01-31) or relative to now (eg: 3.weeks). --cost=<method> Include time cost in person-months (COCOMO) or person-hours (based on commit times). Methods: month(s)|cocomo|hour(s)|commit(s). May be multiple comma-separated values. -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 `tqdm` [default: False]. --warn-binary Don't silently skip files which appear to be binary data [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]. -e, --show-email Show author email instead of name [default: False]. -M Detect intra-file line moves and copies [default: False]. -C Detect inter-file line moves and copies [default: False]. --format=<format> Table format [default: pipe]|md|markdown|yaml|yml|json|csv|tsv|tabulate. May require `git-fame[<format>]`, e.g. `pip install git-fame[yaml]`. Any `tabulate.tabulate_formats` is also accepted. --manpath=<path> Directory in which to install git-fame man pages. --log=<lvl> FATAL|CRITICAL|ERROR|WARN(ING)|[default: INFO]|DEBUG|NOTSET.
如果多个用户名和/或电子邮件对应于同一个用户,则聚合 git-famestatistics并通过添加 .mailmap file。
Examples
CODEOWNERS
生成 CODEOWNERS:
# bash syntax function for current directory git repository owners(){for f in $(git ls-files);do# filename echo -n "$f "# author emails if loc distribution >= 30% git fame -esnwMC --incl "$f"| tr '/''|'\ | awk -F '|''(NR>6 && $6>=30) {print $2}'\ | xargs echodone}# print to screen and file owners | tee .github/CODEOWNERS # same but with `tqdm` progress for large repos owners \ | tqdm --total $(git ls-files | wc -l)\ --unit file --desc "Generating CODEOWNERS"\ > .github/CODEOWNERS