Final cleanup for per-author range.
This commit is contained in:
parent
229fd0a42f
commit
d4efb11e44
3 changed files with 23 additions and 11 deletions
|
@ -16,7 +16,7 @@ module TimeCost
|
|||
|
||||
:verbose => false
|
||||
}
|
||||
@rangelist = nil
|
||||
@rangelist = {}
|
||||
@authorlist = nil
|
||||
end
|
||||
|
||||
|
@ -81,7 +81,7 @@ module TimeCost
|
|||
"--","."]
|
||||
|
||||
|
||||
@rangelist = RangeList.new
|
||||
@rangelist = {}
|
||||
commit = nil
|
||||
loop do
|
||||
line = process.gets
|
||||
|
@ -96,7 +96,11 @@ module TimeCost
|
|||
# merge ranges & push
|
||||
unless commit.nil? then
|
||||
range = Range.new @config, commit
|
||||
@rangelist.add range
|
||||
|
||||
if not @rangelist.include? commit.author then
|
||||
@rangelist[commit.author] = RangeList.new
|
||||
end
|
||||
@rangelist[commit.author].add range
|
||||
end
|
||||
commit = Commit.new id
|
||||
# puts "commit #{id}"
|
||||
|
@ -110,6 +114,7 @@ module TimeCost
|
|||
commit = nil
|
||||
# reject
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
when /^Date:\s*(.*?)\s*$/ then
|
||||
|
@ -170,10 +175,17 @@ module TimeCost
|
|||
def report
|
||||
return if not @config[:output_dump].nil?
|
||||
|
||||
@rangelist.each do |r|
|
||||
puts r.to_s + "\n"
|
||||
@rangelist.each do |author,rangelist|
|
||||
rangelist.each do |range|
|
||||
puts range.to_s + "\n"
|
||||
end
|
||||
end
|
||||
puts "TOTAL: %.2f hours" % @rangelist.sum
|
||||
total = 0
|
||||
@rangelist.each do |author,rangelist|
|
||||
puts "SUB-TOTAL for %s: %.2f hours\n" % [author, rangelist.sum]
|
||||
total += rangelist.sum
|
||||
end
|
||||
puts "TOTAL: %.2f hours" % total
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -97,12 +97,12 @@ module TimeCost
|
|||
end
|
||||
|
||||
def to_s
|
||||
val = "(%s) %s - %s\n" % [diff, fixed_start, @time_stop]
|
||||
val = "(%s)\t%s - %s\n" % [diff, fixed_start, @time_stop]
|
||||
unless @config[:author_filter_enable] then
|
||||
val += "\tby %s\n" % @commits.first.author
|
||||
end
|
||||
@commits.each do |commit|
|
||||
lines = []
|
||||
unless @config[:author_filter_enable] then
|
||||
lines.push commit.author
|
||||
end
|
||||
lines.concat commit.note.split(/\n/)
|
||||
r = lines.map{ |s| "\t %s" % s }.join "\n"
|
||||
r[1] = '*'
|
||||
|
|
|
@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|||
spec.email = ["glenux@glenux.net"]
|
||||
spec.summary = %q{Use GIT logs to give an estimation of spent time & costs of your projects.}
|
||||
spec.description = %q{Use GIT logs to give an estimation of spent time & costs of your projects.}
|
||||
spec.homepage = "https//github.com/glenux/git-timecost"
|
||||
spec.homepage = "https://github.com/glenux/git-timecost"
|
||||
spec.license = "MIT"
|
||||
|
||||
spec.files = `git ls-files -z`.split("\x0")
|
||||
|
|
Loading…
Reference in a new issue