Download from the official website https://code.google.com/p/gitinspector/ and unzip. Requires git and Python 2.6 or higher, with CentOS 6.x yum is probably fine.
gitinspector.py [optional] [path to git repository]
The analysis result is output as standard, so if you want to save it in a file, use redirect.
gitinspector.py -f java,conf,css,html,js,properties,sh,vm,xml -F htmlembedded -THmrl /home/mriit/ITRM > /var/www/html/inspector_simple.html
Specify the extension of the file you want to analyze with -f separated by commas, specify the output format with -F, and the default is text format. The html format refers to jQuery etc. from the outside, and html embedded is the one that embeds them. There are officially various samples, some of which are listed below.
For each author, the number of commits, the number of added lines, the number of deleted lines, the rate of change, the number of changed lines for each month (-W for each week), etc. are displayed.
When I used it as it was, I got the error "git blame doesn't have e option". Confirmed that git 1.7.1 does not have -e in blame. There is a description in blame.py, so I decided to play with it.
After trying various things, -n seems to be the correct answer, so make the relevant part as follows
blame.py
blame_string = "git blame -n -w {0} ".format("-C -C -M" if hard else "") + \
Then, it seems that the author's name acquisition did not go well ... Is the following method taking an email from the output of git blame and taking the name of the author based on it?
blame.py
@staticmethod
def get_author_email(string):
author_email = re.search(" \((.*?)\d\d\d\d-\d\d-\d\d", string)
return author_email.group(1).strip().lstrip("<").rstrip(">")
changes.py
def get_latest_author_by_email(self, name):
return self.authors_by_email[name]
When I did git blame in my environment, the name of the author appears, so I thought that it would be better not to do that, so I changed the above method to return the name I got, and it worked. .. I think there is a more appropriate solution, but for the time being, this is it.
It's full of crap, but I'm glad I got the information from the repository for the time being. There may have been a problem with git as well. Look at this regularly when developing with git. If the period is short, it may be better to display it weekly.
Recommended Posts