http://qiita.com/7of9/items/e1e151794f80fb9c24fc I tried to implement the integrated estimate of the work time that I thought about while studying python.
First, create a tmp.log file in the git repository you want to investigate.
$ git log --pretty=format:'%h %ad %s' --date=iso > tmp.log
After that, if you execute the script, tmp.log will be read and the accumulated time will be displayed.
$ ./git_log_analysis.py
The display format is as follows, and 764 in the last line is the accumulated time (minutes).
...
2015-11-13 21:11:06 801 750 # sec, min
2015-11-13 12:53:26 29860 750 # sec, min
2015-11-13 12:44:36 530 758 # sec, min
2015-11-13 12:37:53 403 764 # sec, min
2015-11-13 07:12:08 19545 764 # sec, min
The linemonitor python implementation (core part) seems to have taken a total (at least) 12 hours.
In the total time calculation, it is considered that there was no work for 4 hours or more. In my case, I don't commit for more than 4 hours. The user should change this area as appropriate.
def calcElapsedTimeInMinutes(diff_sec):
diff_min = diff_sec / 60
diff_hr = diff_min / 60
if diff_hr >= 4:
return 0
else:
return diff_min
Since it is basically just the difference between the two dates and times, at least the following uncertainties are included
--I haven't taken all the time difference into the implementation --Estimates deviate when working while switching between multiple repositories
v0.2
Hitting the git log command one by one seemed tedious.
I remembered that I was executing a command when I implemented shutdownButton, so in v0.2 I made tmp.log automatically. Note that if tmp.log already exists, it will be overwritten.
Recommended Posts