一个项目有多少人参与?基于修订控制系统
您如何知道有多少开发人员参与了使用修订控制系统的项目?我的一个朋友在 git log 中查找答案时发现了这种方法:
git log | grep Author: | sort -u | cut –delimiter=” ” -f2 | sort -u | wc -l
Is there a simple way in git?其他版本控制系统(如 Subversion、Bazaar 或 Mercurial)怎么样?
How do you know how many developers were involved in a project using a Revision Control System? A friend of mine found this way to look up the answer in git log:
git log | grep Author: | sort -u | cut –delimiter=” ” -f2 | sort -u | wc -l
Is there a straightforward way in git? How about other Revision Control System like Subversion, Bazaar or Mercurial?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Bazaar 有一个统计插件,可以获取有关项目贡献者的不同信息:
https://launchpad.net/bzr-stats /
There is stats plugin for Bazaar to get different info about project contributors:
https://launchpad.net/bzr-stats/
我也不知道 Mercurial 有什么直接的方法,并且对其所有文档进行了很好的搜索也没有透露任何信息。所以,这里有一个 *nix 命令,类似于你的朋友在 Mercurial 中找到的命令:
顺便说一句,我认为 git 命令有一个错误,第二个
sort -u
肯定应该替换为 uniq !I'm not aware of a straightforward way for Mercurial either and a good search of all its documentation didn't revealed anything too. So, here's a *nix command, similar to the one your friend found, for Mercurial:
BTW, I think there's an error with the command for git, the second
sort -u
should surely be replaced by uniq!Mercurial 内置了强大的模板语言(请参阅
hg 帮助模板
)。因此,您可以获取项目中所有人员的列表,而无需启用流失扩展:如果人们更改了电子邮件地址(但姓名保持不变),那么您可以处理
author
模板关键字一点:然后根据上述命令添加
wc -l
。Mercurial has a powerful template language built-in (see
hg help templates
). So you can get a list of all people in the project without enabling the churn extension:If people have changed their email address (but otherwise kept their name the same), then you can process the
author
template keyword a bit:Then add
wc -l
as appropriate to the above commands.一个更简单的 git 版本是:
或者如果您关心唯一的电子邮件地址:
A simpler git version is:
or if you care about unique email addresses:
git
shortlog
命令非常有用。这总结了典型的 git-log 输出。传递到
wc
以查看唯一用户名的数量:git
The
shortlog
command is very useful. This summarizes the typicalgit-log
output.Pass to
wc
to see the number of unique usernames:对于 Mercurial,有一个扩展可以做到这一点:
hg churn
。hg churn
按行更改排序,如果您想要更改集计数,请使用hg churn -c
。For mercurial, there's an extension to do exactly that:
hg churn
.hg churn
sorts by line-changed, if you want changeset count, usehg churn -c
.为了颠覆
For subversion