跳转到主要内容

git提交频率的打孔卡生成器

项目描述

git-punchcard

简单的git打孔卡实用工具,受git-punchcard-plot启发,但用matplotlib重新编写,用于python3。

Screenshot

安装

按照以下方式从PyPI安装或升级

pip install --user --upgrade git-punchcard[gui]

此外,请确保$HOME/.local/bin已添加到$PATH中。

为了避免与其他包冲突,我建议在一个隔离环境中安装,例如使用pipx

pipx install git-punchcard[gui]

用法

基本用法

git punchcard

可以按照以下方式指定附加参数

git punchcard [<input path>...] [<options>]
              [--] [<log options>] [<revision range>] [-- <path>...]

有关可用选项的更多信息,请键入

git punchcard -h            # [options]
git help log                # [log options]
git help gitrevisions       # [revision]

选项

最常用的内置选项如下

# use a fixed timezone for all commits:
git punchcard --timezone CET
git punchcard --timezone Europe/Berlin
git punchcard --timezone UTC+02:30

# show punchcard with specified y/x axes:
git punchcard -p year/month
git punchcard -p wday/month

# histogram with specified x axis:
git punchcard -p /wday

# set the directory of the git repository (multiple allowed):
git punchcard /path/to/repo

# analyze all repositories in ~/dev:
git punchcard ~/dev/*/.git

# read commit dates from stdin:
git punchcard -

# show a github-like punchcard plot with grid:
git punchcard --grid

默认情况下,每个提交的本地时区用于绘图。如果设置固定时区,它应指定为时区名称(例如CETEurope/Berlin),但也可以通过ISO 3166国家代码或国家名称(如果时区不明确,我们将选择第一个条目)来指定。

git log选项

此外,您还可以传递任何由git log理解的选项,例如限制提交范围并限制由特定作者执行的提交

# include only commits by specific author:
git punchcard --author=myself

# consider only only the 20 commits:
git punchcard master~20..master

# commits within a certain time frame:
git punchcard --since="1 year ago" --until=now

# show at which times a certain file/folder is usually edited:
git punchcard --follow -- README.rst docs

# show at which times, people like to merge:
git punchcard --merges

高级示例

跟踪年提交活动的演变

for year in {2016..2019}; do
    git punchcard -o $year.png --title $year \
        --since 1.1.$year --until 31.12.$year
done

更改

2.0.4

日期:2021年10月28日

  • 添加pyqt作为可选的gui依赖项,例如:pip install git-punchcard[gui]

  • 从Travis CI迁移到GitHub Actions

2.0.3

日期:2019年10月31日

  • 在源分发中包含许可证文件

2.0.2

日期:2019年10月31日

  • 自动部署

  • 设置和测试中的更改

2.0.1

日期:2019年3月26日

  • 修复:如果没有用户传入输入路径,则默认为当前目录

2.0.0

日期:2019年3月26日

  • -C转换为位置参数,移除-C选项

  • 允许多个输入文件

  • 允许传入带有git log输出的-和文件作为输入文件

  • 删除对docopt的过时依赖

  • 允许传入国家代码和名称而不是时区(在存在歧义的情况下使用第一个可用的时区)

  • 不区分大小写地匹配时区

  • 显示git命令和提交次数

  • 对于常见错误,显示错误消息而不是跟踪记录

1.4.0

日期:2019年3月26日

  • 学习--period Y/X参数来指定Y/X轴

  • 可以通过留空一个轴来绘制直方图

  • -v视为--version的别名

1.3.0

日期:2019年3月21日

  • 现在直接传递日志选项,而不使用--,与其他选项相同

  • 取消对docopt的依赖

1.2.0

日期:2019年3月21日

  • 修复在未调用运行时依赖项时setup.py异常

  • 仅在需要时导入pytz

  • 学习一个-C DIR参数来传递git仓库的路径

  • 学习一个--version参数来显示脚本版本

  • 修复同时传递选项和git选项时的错误

  • 转换为模块,并使用setuptools entry_points生成脚本

1.1.0

日期:2019年3月11日

  • 添加--title参数

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

git-punchcard-2.0.4.tar.gz (8.2 kB 查看哈希值)

上传时间:

构建分发

git_punchcard-2.0.4-py3-none-any.whl (7.6 kB 查看哈希值)

上传时间: Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面