如果你是项目经理 或者是HR, 你一定想了解每个程序员的活动情况. 比如 哪个季节月份请假的人比较多 而或哪些人平时比较积极 哪些人比较偷懒等. 我们可以根据SVN提交的记录来画出每次时间点上 每个开发者的提交次数.
通过以下命令能获得SVN历史提交记录, 生成XML输出并且通过 GREP命令筛选出只含提交者的名字 (去掉多余的标记)
1 | svn log -v --xml | grep "author.*/author" |
svn log -v --xml | grep "author.*/author"
使用POWERSHELL编译脚本中的DICTIONARY对象 统计每个程序员的提交次数 然后分别写入文件中. 再通过JENKINS的PLOT插件画出来即可.
<# .DESCRIPTION Count SVN Commits #> Task SVNLog { Set-Location "$WorkingCopyDir" $log = &svn log -v --xml | grep "author.*/author" $dict = @{} $logarr = $log -replace "<author>", "" -replace "</author>", " ".Trim().Split(" ") | ForEach-Object { $author = $_.Trim() if ($author.Length -gt 2) { if ($dict.ContainsKey($author)) { $cur = $dict[$author] $dict[$author] = $cur + 1 } else { $dict[$author] = 1 } } } Write-Host "***********************************Commits Statistics************************************" $dict.GetEnumerator() | Sort-Object Value -descending $total = 0 foreach ($author in $dict.GetEnumerator()) { if ($author.Key -ne $null -and $author.Value -ne $null) { $file = $author.Key + ".svn.txt" Write-Host $file $filename = Join-Path "$SolutionDir" "$file" Write-Host $filename $total = $total + [convert]::ToInt32($author.Value, 10) Write-Host "$total" WritePropertyFile $filename $author.Value.ToString() "https://helloacm.com" Write-Host "$filename has been written." } } Write-Host "******TOTAL SVN COMMITS = $total ***********************" $filename = Join-Path "$SolutionDir" "svn.total.txt" WritePropertyFile $filename $total.ToString() "https://helloacm.com" Write-Host "$filename has been written." }
画出来大概长这样子:
GD Star Rating
loading...
本文一共 187 个汉字, 你数一下对不对.loading...
上一篇: QUICKHOSTUK 主机升级网络到千兆BIT
下一篇: 4英镑通过SNAPFISH洗了 200张6x4寸的照片
扫描二维码,分享本文到微信朋友圈