我需要在特定时间段内计算源代码中的行更改数。
也就是说,通过使用提交ID,我可以知道源代码中的行更改数吗?
我不需要每个用户的行更改。我需要在那些提交之间所有行更改的数量。
我的Gitlab Community Edition版本是8.14.3。
更新
我所有的源代码都存在于mycompany.gitlab.com中。我该如何解决上述问题?
我需要在特定时间段内计算源代码中的行更改数。
也就是说,通过使用提交ID,我可以知道源代码中的行更改数吗?
我不需要每个用户的行更改。我需要在那些提交之间所有行更改的数量。
我的Gitlab Community Edition版本是8.14.3。
更新
我所有的源代码都存在于mycompany.gitlab.com中。我该如何解决上述问题?
git diff <commit-1> <commit-2> --shortstat
7 files changed, 39 insertions(+), 107 deletions(-)
git diff <155ee1c3> <bb674347> --shortstat
我得到了异常
< 在此时是意外的。 - user6874415git diff 155ee1c3 bb674347 --shortstat
替代。符号“<>”仅为格式指示。 - Robin Xinggit diff master --shortstat
比较我的分支和主分支上的更改行数。 - Erdős-Bacon所有引用的代码均可在 https://docs.gitlab.com/ee/api/commits.html 中找到。
获取所有提交(包括 since 和 until 参数):
https://gitlab.example.com/api/v3/projects/:project_id/repository/commits
获取提交的差异:
https://gitlab.example.com/api/v3/projects/:project_id/repository/commits/:sha/diff
将上述终端节点中的diff
字段拆分,以获取每个提交所更改的行并进行求和。
我通过以下步骤找到了答案