Today I needed to find the number of commits per file in a directory. Doing that by going into each files’ mercurial log and counting manually is a incredibly boring chore. But, the following PowerShell script came to save my life:
dir -r | % { New-Object PSObject -Property ` | |
@{ ` | |
Count = hg log -q $_.Name | wc -l; ` | |
FileName = $_.Name; ` | |
}} ` | |
| % { $_.Count + ' -- ' + $_.FileName; } |
If gist embed is not working above, click here.