Something suddenly occurred to me that we can calculate total working time from git log by and large.
To do so, and to study python, I tried to make a python script.
Program v0.1 @ github v0.2 @ github
How to use
~~Firstly, you need to create tmp.log
file by git log command at the repository you want to investigate.~~
In version v0.2 and later, you do not need to run git log command. Instead, the script automatically make tmp.log file.
$ git log --pretty=format:'%h %ad %s' --date=iso > tmp.log
Then, you can obtain the total working time by the script:
$ ./git_log_analysis.py
The output is as follows. The last line includes the total working time in minutes (e.g. 764).
...
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
Uncertainty in the calculation
The script takes the elapsing time more than and equal to 4 hours as zero. This is for my case. The user can modify according to their commiting style.
def calcElapsedTimeInMinutes(diff_sec):
diff_min = diff_sec / 60
diff_hr = diff_min / 60
if diff_hr >= 4:
return 0
else:
return diff_min
The script only takes the two datetime difference. Therefore, there might have the various uncertainties including:
Link Related (in Japanese) http://qiita.com/7of9/items/e1e151794f80fb9c24fc
Recommended Posts