Created
June 7, 2014 14:29
-
-
Save ashphy/2c2c1b24d7e036e5cdd7 to your computer and use it in GitHub Desktop.
Git repository inspection script for chromium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Git repository inspection script for chromium | |
# See to get the code: http://www.chromium.org/developers/how-tos/get-the-code | |
# Kazuki Hamasaki <ashphy@ashphy.com> | |
require 'rugged' | |
REPO = '.' | |
REVIEW_COMMIT = /Review URL:/i | |
BOT_COMMITS = [/Updating trunk VERSION/, /Update .DEPS.git/, /Automated Commit/] | |
REVERT_COMMIT = /Revert r/ | |
# This may be operated by human, but it should be routine operation | |
WEBKIT_ROLL_COMMIT = /Webkit roll/ | |
commits = 0 | |
non_reviews = 0 | |
bot_commits = 0 | |
revert_commits = 0 | |
webkit_role_commits = 0 | |
repo = Rugged::Repository.new REPO | |
p "List all non-reviewed commits for #{repo.workdir}" | |
walker = Rugged::Walker.new(repo) | |
walker.push(repo.last_commit()) | |
walker.each do |c| | |
commits +=1 | |
unless c.message =~ REVIEW_COMMIT | |
non_reviews += 1 | |
#p c.oid | |
#p c.message.inspect | |
BOT_COMMITS.each { |cond| bot_commits += 1 if c.message =~ cond } | |
revert_commits += 1 if c.message =~ REVERT_COMMIT | |
webkit_role_commits += 1 if c.message =~ WEBKIT_ROLL_COMMIT | |
end | |
end | |
p "There are #{non_reviews} commits in the all #{commits} commits" | |
p "#{bot_commits} commites by bot were found" | |
p "#{revert_commits} commites by revert were found" | |
p "#{webkit_role_commits} commites by webkit role were found" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"There are 18081 commits in the all 216922 commits"
"9628 commites by bot were found"
"89 commites by revert were found"
"34 commites by webkit role were found"