Merge branch 'develop' of github.com:glenux/git-timecost into develop

This commit is contained in:
@@@No user configured@@@ 2014-09-24 09:20:18 +02:00
commit fed30d62a2

View file

@ -25,7 +25,7 @@ class GitExtractor
def initialize config, commit def initialize config, commit
@config = config @config = config
@time_stop = DateTime.parse(commit.date) @time_stop = DateTime.parse(commit.date)
@time_start = @time_stop - (1.5 / 24.0) @time_start = @time_stop - (@config[:range_granularity] * 3 / 24.0)
@commits = [commit] @commits = [commit]
self self
end end
@ -101,7 +101,7 @@ class GitExtractor
end end
def fixed_start def fixed_start
return @time_start + (0.5/24.0) return @time_start + (@config[:range_granularity]/24.0)
end end
def diff def diff
@ -181,6 +181,8 @@ class GitExtractor
:input_dump => [], :input_dump => [],
:output_dump => nil, :output_dump => nil,
:range_granularity => 0.5, # in decimal hours
:verbose => false :verbose => false
} }
@rangelist = nil @rangelist = nil
@ -225,6 +227,13 @@ class GitExtractor
@config[:author_filter] = author @config[:author_filter] = author
@config[:author_filter_enable] = true @config[:author_filter_enable] = true
end end
# overlap :
#
opts.on("-s","--scotch GRANULARITY", "Use GRANULARITY (decimal hours) to merge ranges") do |granularity|
puts "set scotch to #{granularity}"
@config[:range_granularity] = granularity.to_f
end
end end
opts.parse! args opts.parse! args
@ -234,7 +243,10 @@ class GitExtractor
def analyze_git def analyze_git
# git log # git log
# foreach, create time range (before) + logs # foreach, create time range (before) + logs
process = IO.popen ["git", "log", "--date=iso"] process = IO.popen ["git", "log",
"--date=iso",
"--no-patch",
"--","."]
@rangelist = RangeList.new @rangelist = RangeList.new
@ -242,6 +254,8 @@ class GitExtractor
loop do loop do
line = process.gets line = process.gets
break if line.nil? break if line.nil?
# utf-8 fix ?
# line.encode!( line.encoding, "binary", :invalid => :replace, :undef => :replace)
line.strip! line.strip!
case line case line
@ -289,8 +303,6 @@ class GitExtractor
end end
end end
def exec
end
end end
end end