Created
July 16, 2009 15:08
-
-
Save vitaliel/148462 to your computer and use it in GitHub Desktop.
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
# Output with command | |
# git log --format="//%h/%ae/%ai/%s" --name-only --relative="iChart ASP.net/" -- iChart ASP.net/ | |
# | |
class GitBrowseInfo | |
def initialize(str) | |
@str = str | |
end | |
def parse | |
sha = email = datetime = subject = nil | |
files = {} | |
@str.each_line do |line| | |
next if line.length < 2 # last char is \n | |
if line[0..1] == "//" | |
_, _, sha, email, datetime, subject = line.split('/', 6) | |
else # is a file path | |
# dir ? | |
if idx = line.index('/') | |
name = line[0..idx] | |
else | |
name = line.chomp | |
end | |
files[name] ||= [sha, email, datetime, subject.chomp] | |
end | |
end | |
require "pp" | |
pp files | |
# TODO sort them: dirs first | |
end | |
end | |
File.open("files.txt") do |f| | |
GitBrowseInfo.new(f.read).parse | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment