hg commit count in a directory


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; }
view raw commit_counta.ps1 hosted with ❤ by GitHub

If gist embed is not working above, click here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.