Git Product home page Git Product logo

gitstats's People

Contributors

amotl avatar andrey9kin avatar beastd avatar chilikink avatar doudou avatar dspinellis avatar ernesto-jimenez avatar flatcap avatar hoxu avatar hughescr avatar janihur avatar janpieper avatar karl82 avatar mattparlane avatar moy avatar nerdrew avatar penberg avatar philantrop avatar ranginui avatar skuschel avatar stezz avatar svenvh avatar tnielsen avatar tobix avatar tomk32 avatar xsgordon avatar zlin avatar zsx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gitstats's Issues

Domain stats and mailmap

As of pull #35 merging author information is now handled by .mailmap.

Yet developers use the file for two distinct reasons:

  • to correct typos
  • redirect people from one email to another - most commonly from corporate to development one.

That leads to companies getting smaller attribution in the "Commits by Domain" section.
Sadly we cannot correct every project to use .mailmap 'correctly', yet we want to give credit where it's due.

I would like to address that and the quickest way is to revert the above PR.
Any objections, alternative suggestions how to address the issue?

Error while running gitstats with linux kernel repository and old git versions

Original title: Error while running gitstats with opensuse kernel

I've cloned the following repository

git://gitorious.org/opensuse/kernel.git

While running ./gitstats /path/to/git/repo /output/folder I face this error

"[2.11899] >> git shortlog -s "v3.0.78" "^v3.9.1"
[1.76242] >> git shortlog -s "v3.4.45" "^v3.0.78"
[1.95104] >> git shortlog -s "v3.8.13" "^v3.4.45"
[0.57330] >> git shortlog -s "v3.9.2" "^v3.8.13"
[0.69536] >> git shortlog -s "v3.10-rc1" "^v3.9.2"
[1.95851] >> git shortlog -s "v3.2.45" "^v3.10-rc1"
[6.77937] >> git shortlog -s "rpm-3.0.74-0.6.8" "^v3.2.45"
[0.03402] >> git shortlog -s "v3.0.79" "^rpm-3.0.74-0.6.8"
[1.77202] >> git shortlog -s "v3.4.46" "^v3.0.79"
[2.23483] >> git shortlog -s "v3.9.3" "^v3.4.46"
[0.71021] >> git shortlog -s "v3.10-rc2" "^v3.9.3"
[12.44785] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^commit
Traceback (most recent call last):
File "./gitstats", line 1430, in
g.run(sys.argv[1:])
File "./gitstats", line 1407, in run
data.collect(gitpath)
File "./gitstats", line 312, in collect
author, mail = parts[4].split('<', 1)
IndexError: list index out of range
"
FYI
a) I repeated the process more than 3 times and the error still appears.
b) With other repositories I had no issue or any error while running ./gitstats.

Anyone ran this on win 8 machine?

I've installed Python 2.7.
I've installed gnuplot.
I have git.

I've added python path, gunplot path and the folder where gitstats sit into the system path.

running "python gitstats git_repo_path out_path" chucks a couple of lines, and then runs into an endless loop of missing and failed imports.

here's a screenshot: http://i.imgur.com/QHwpgU0.png

any suggestions ?

license file does not accurately reflect licensing of sortable.js

The doc/license file states that the licensing of the project is as follows:

License is GPLv2/GPLv3, see doc/GPLv2 and doc/GPLv3 respectively.

The header of the sortable.js file has this statement:

Table sorting script  by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/.
Based on a script from http://www.kryogenix.org/code/browser/sorttable/.
Distributed under the MIT license: http://www.kryogenix.org/code/browser/licence.html .

Copyright (c) 1997-2007 Stuart Langridge, Joost de Valk.

The license file should be updated to more accurately reflect the licensing for the project. For consistency the name of the file should also be LICENSE (all caps).

list index out of range

I am getting the following error when I try to execute
./gitstats -c start_date="$(date +%Y-%m-%d -d "3 month ago")" "/repository/<repo_name>/.git" "/repository/gitresult"

Error:
[0.00403] >> git shortlog -s --since="2018-05-29" "HEAD" | wc -l
[0.00518] >> git show-ref --tags
[0.00352] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" --since="2018-05-29" "HEAD" | grep -v ^commit
Traceback (most recent call last):
File "./gitstats", line 1490, in
g.run(sys.argv[1:])
File "./gitstats", line 1465, in run
data.collect(gitpath)
File "./gitstats", line 338, in collect
timezone = parts[3]
IndexError: list index out of range

Surprisingly, It works when I change the date to 4 month ago. I have no idea why it the error is occurring. Is it something related to different commits in repository?

'wc' is not recognized on Windows (have to use cygwin to use gitstats)

Hi,

I was unable to use gitstats on Windows (unless I run it through cygwin).

It complains that wc command is unrecognized, which is expected as it's not present on Windows:

C:\Program Files>python C:\git\gitstats\gitstats C:\git\DscPublisher C:\git\GitS
tatsOutputDscPublisher
[0.03100] >> gnuplot --version
Output path: C:\git\GitStatsOutputDscPublisher
Git path: C:\git\DscPublisher
Collecting data...
'wc' is not recognized as an internal or external command,
operable program or batch file.
[0.03100] >> git shortlog -s HEAD | wc -l
Traceback (most recent call last):
  File "C:\git\gitstats\gitstats", line 1490, in <module>
    g.run(sys.argv[1:])
  File "C:\git\gitstats\gitstats", line 1465, in run
    data.collect(gitpath)
  File "C:\git\gitstats\gitstats", line 289, in collect
    self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(
), 'wc -l']))
ValueError: invalid literal for int() with base 10: ''

One of the lines which uses wc is:

        self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l']))

When I tried running gitstats through cygwin, everything worked, but I don't see it listed as requirement anywhere, so I'd assume it should be running on Windows without it as well.

XML output

Would be nice to get the raw output as XML so it can be easily aggregated into a database.

plot with steps

I'd suggest plots using the "with steps" style rather than "with lines", so that large jumps e.g. in lines of code that come after a long no-commit period show up as a vertical jump following a horizontal line, rather than a diagonal line.

shutil.Error: gitstats.css and gitstats.css are the same file

Refining data...
Saving cache...
Generating report...
Traceback (most recent call last):
  File "./gitstats", line 1490, in <module>
    g.run(sys.argv[1:])
  File "./gitstats", line 1477, in run
    report.create(data, outputpath)
  File "./gitstats", line 744, in create
    shutil.copyfile(src, path + '/' + file)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 69, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/Users/samm/othergit/gitstats/gitstats.css` and `/Users/samm/othergit/gitstats/gitstats.css` are the same file

IndexError: list index out of range during collect

When running gitstats, I am seeing an IndexError: list index out of range error. This is the first time running gitstats on this repo.

[[0.08800] >> git cat-file blob 42468d8ff605ff955b875916bfc80acdf95fe1c4 | wc -l
2.71800] >> git cat-file blob b2c62966c30359a015256e3f513bac08331438c0 | wc -l
Traceback (most recent call last):
  File "gitstats.py", line 1490, in <module>
    g.run(sys.argv[1:])
  File "gitstats.py", line 1465, in run
    data.collect(gitpath)
  File "gitstats.py", line 518, in collect
    ext_blob_linecount = pool.map(getnumoflinesinblob, blobs_to_read)
  File "C:\Python27\Lib\multiprocessing\pool.py", line 251, in map
    return self.map_async(func, iterable, chunksize).get()
  File "C:\Python27\Lib\multiprocessing\pool.py", line 558, in get
    raise self._value
IndexError: list index out of range

When I run this git cat-file command, this is what is returned:

C:\projects\sandbox>git cat-file blob d469d018cece658a71ced1c7cf3cfffce2d24f9d | wc -l
     97

C:\projects\sandbox>git cat-file blob 61f9e75f9b63ded44c5d3fc9a9269bb86bb647bd | wc -l
    161

C:\projects\sandbox>git cat-file blob 88e064f90313a614abd6b3a2081bcb21c0539cb2 | wc -l
     45

C:\projects\sandbox>git cat-file blob 7180af8494c4dae57cad082b42277298b00b8669 | wc -l
    331

C:\projects\sandbox>git cat-file blob 49ffd7368bc396cd10dbf3e7439b7d0f296010cf | wc -l
     97

C:\projects\sandbox>git cat-file blob f0ce1e6845fff2a765cad458e987fc06f083b3f7 | wc -l
    250

C:\projects\sandbox>git cat-file blob df0fc164e6b33bbc382d5a6c51c002199b551834 | wc -l
     26

C:\projects\sandbox>git cat-file blob a6912c1194cc19ce52e58ca03de5ded92835eb7b | wc -l
     32

C:\projects\sandbox>git cat-file blob 42468d8ff605ff955b875916bfc80acdf95fe1c4 | wc -l
    109

C:\projects\sandbox>git cat-file blob b2c62966c30359a015256e3f513bac08331438c0 | wc -l
     96

C:\projects\sandbox>git cat-file blob d7ac3f820842c8eed99882cdba9b89d729070415 | wc -l
    107

C:\projects\sandbox>git cat-file blob 9f3794ba017d460ad9ef77004f95755bc4817ffb | wc -l
     76

C:\projects\sandbox>git cat-file blob f558f59e09d9e181a6a35a08092ed46ed3380916 | wc -l
    236

C:\projects\sandbox>git cat-file blob f5f7834784f05eb7291cf54152b84996dcbe7b7b | wc -l
     11

C:\projects\sandbox>git cat-file blob 69eaececede172cf1029c7c0c1d7adef505b924d | wc -l
     89

Tag a release?

Hello,

It’d be great if you could tag a stable release so we can use the GitHub-generated tarball instead of relying on the git HEAD commit.

Thanks!

start_date broke commit_begin command line option

I think commit 780c0fd (start_date command line option) introduced a bug that broke commit_begin command line option.

def getlogrange(defaultrange = 'HEAD', end_only = True):
    commit_range = getcommitrange(defaultrange, end_only)
    if len(conf['start_date']) > 0:
        return '--since=%s %s' % (conf['start_date'], commit_range)
    return commit_range

The way how getlogrange is implemented and called in other parts means commit_begin has no effect.
I propose the following fix:

  1. Make start_date and commit_begin command line options mutually exclusive - only one of them can be defined. Error will be raised if both options are present.
  2. Modify getxxxrange so that all combinations of start_date, commit_begin and end_only are handled correctly.

Additional graphs

Hello

I'm currently writing my master thesis and use gitstats to track progress on my writing.
I'm missing two metrics to do so a little bit better.

a) Commits per day.
Showing a graph of the last 30 (maybe 90) days with the number of commits.

b) Word count
As I make notes, the document gets many lines, but as I reduce the codes to text, the number of lines reduces, so the graph isn't really helpful anymore. What I would need is the growing number of words.

Thanks for the nice project :)

could you integrate git treemap?

Hi,

I wrote a git dynamic repository visualization (see examples at: https://github.com/joe42/git_treemap).
I would like to integrate git treemap with gitstats. If you are interested, I will write a suitable pull request.
Momentarily, git treemap produces an html file with a dynamic treemap relying on the InfoViz JavaScript Toolkit. To this end, the git repository statistics are efficiently extracted with GitPython and inserted as JSON data into an html template with the help of Python's Template module.
Please let me know if you are interested to integrate git treemap.

Thanks for writing and maintaining gitstats,
joe

git rev-list | grep choke on utf-8 in comments

in Collect revision statistics

lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), 'grep -a -v ^commit']).split('\n')
<<
grep breaks the PIPI with: Binary file (standard input) matches.
Adding -a to grep solves the issue.

gnuplot not found

gnupolt not found problem, though had configured gnuplot environment variable(means I can get gnuplot version when type in 'gnuplot --version'),

So I solved this by delete the three lines, and It worked

if not getgnuplotversion():

print 'gnuplot not found'

sys.exit(1)

gitstats project execution to "git shortlog-s HEAD | wc-l" error

git shortlog -s HEAD | wc -l
^CTraceback (most recent call last):
File "gitstats/gitstats", line 1432, in
g.run(sys.argv[1:])
File "gitstats/gitstats", line 1409, in run
data.collect(gitpath)
File "gitstats/gitstats", line 262, in collect
self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getcommitrange(), 'wc -l']))
File "gitstats/gitstats", line 58, in getpipeoutput
output = p.communicate()[0]
File "/usr/lib/python2.6/subprocess.py", line 693, in communicate
stdout = self.stdout.read()
KeyboardInterrupt

How to generate report for all branches not only the main branch ?

Hi All,

I need statistics for commits,lines in all branches in specific repository.
I saw FAQ in man gitstats , but it seems not work, it still generate the report for only the main branch.

gitstats -c commit_end='web' -c start_date='2017/1/1' cosmos-main-html5 gitstats

Can anybody help on this ?

FAQ
Q: How do I generate statistics of a non-master branch?

   A: Use "-c commit_end=web" parameter.

regards,
Jonas

ValueError: invalid literal for int() with base 10: '-'

On ubuntu 12.04, when I use the command : gitstats ../wsb/code/sud-ouest-france ~/gitstat

the processing starts, then :

Traceback (most recent call last):
File "/usr/bin/gitstats", line 1383, in
g.run(sys.argv[1:])
File "/usr/bin/gitstats", line 1360, in run
data.collect(gitpath)
File "/usr/bin/gitstats", line 414, in collect
size = int(parts[3])
ValueError: invalid literal for int() with base 10: '-'

SyntaxError: invalid syntax

After running :
gitstats -c start_date="2016-01-01" . ../stats

I get this error :
File "/usr/local/bin/gitstats", line 57 print '>> ' + ' | '.join(cmds), ^ SyntaxError: invalid syntax

parsing "git rev-list" was failed if the user name including a space character.

[0.26964] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^commit
Traceback (most recent call last):
File "/usr/bin/gitstats", line 1490, in
g.run(sys.argv[1:])
File "/usr/bin/gitstats", line 1465, in run
data.collect(gitpath)
File "/usr/bin/gitstats", line 339, in collect
author, mail = parts[4].split('<', 1)
ValueError: need more than 1 value to unpack

In my case, The %aN is "Shinichiro Nakamura", so "parts[4].split('<', 1)" was failed.

Error when running with output directory = gitstats source

Started with outputpath = local git checkout.

cd Downloads/gitstats-master && ./gitstats /Users/X/git/myrepo .

Error observed:

Refining data...
Saving cache...
Generating report...
Traceback (most recent call last):
  File "./gitstats", line 1490, in <module>
    g.run(sys.argv[1:])
  File "./gitstats", line 1477, in run
    report.create(data, outputpath)
  File "./gitstats", line 744, in create
    shutil.copyfile(src, path + '/' + file)
  File "/usr/local/Cellar/python@2/2.7.15_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
    raise Error("`%s` and `%s` are the same file" % (src, dst))
shutil.Error: `/Users/XYZ/Downloads/gitstats-master/gitstats.css` and `/Users/XYZ/Downloads/gitstats-master/gitstats.css` are the same file

Perhaps it would help to either check on startup (a) if the local directory is the "source" directory, and/or (b) if the resources that gitstats will to deploy already exist? On big Git repositories, this would save the user from re-starting the whole process.

Support running gitstats in a python3-only environment

It's been brought to my attention that Fedora 31 will be going Python3 only:

https://fedoraproject.org/wiki/Changes/F31_Mass_Python_2_Package_Removal
https://bugzilla.redhat.com/show_bug.cgi?id=1737997

As it stands this will result in the removal of gitstats from the Fedora repositories, though I am investigating how to avoid this (by e.g. carrying patches to make it python3 compatible).

I thought I'd ask however if there was any plan with regards to supporting python3 for gitstats, as while Fedora is likely pushing the curve here other distributions may follow suit in future? As far as I can tell this last came up back in 2015 as distros started defaulting /usr/bin/python to python3:

#52
https://bugzilla.redhat.com/show_bug.cgi?id=1583357

Add support for blacklisting specific paths/files

Currently, if someone commits a large configuration file or some third-party code, it distorts the stats as well as the associated graphs. Is there a way to blacklist certain files or paths?

Lines of Code (with names removed)lines_of_code

Thanks,
-Anthony

P.S. I work in robotics, so large configuration files are not uncommon (e.g. a list of GPS way-points for a testing area)

How to run gitstats on OS X

Hello there,

just if anybody tried to run gitstats with OS X El Capitan, for me these steps worked:

  • Clone gitstats repository
  • Get homebrew, if you not already have
  • Install gnuplot via homebrew brew install gnuplot
  • Symlink your python 2.7 installation to "python2"
    sudo ln -s /usr/bin/python2.7 /usr/local/bin/python2
  • make install in repository root (xcode and developer tools are required)

Cannot find python2 for env

I try to run gitstats with Python 2.7.1 installed, however it says:
env: python2: No such file or directory

Traceback

gitstats . stats
[0.43809] >> gnuplot --version
Output path: /home/johannes/Dokumente/Universität/Informatik/Master/12ss/Masterarbeit/stats
Loading cache...
Git path: .
Collecting data...

git shortlog -s HEAD | wc -lerror: Could not read b7924b0488d62b9aecaead77ae47608fa172ef46
fatal: Failed to traverse parents of commit 32780257da003ca294d825abdc2d5226c824e62f
[0.01169] >> git shortlog -s HEAD | wc -l
[0.00487] >> git show-ref --tags
git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^commiterror: Could not read b7924b0488d62b9aecaead77ae47608fa172ef46
fatal: Failed to traverse parents of commit 32780257da003ca294d825abdc2d5226c824e62f
[0.01512] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^commit
git rev-list --pretty=format:"%at %T" HEAD | grep -v ^commiterror: Could not read b7924b0488d62b9aecaead77ae47608fa172ef46
fatal: Failed to traverse parents of commit 32780257da003ca294d825abdc2d5226c824e62f
[0.01445] >> git rev-list --pretty=format:"%at %T" HEAD | grep -v ^commit
[0.02945] >> git ls-tree -r -l -z HEAD
git log --shortstat --first-parent -m --pretty=format:"%at %aN" HEADerror: Could not read b7924b0488d62b9aecaead77ae47608fa172ef46
fatal: Failed to traverse parents of commit 32780257da003ca294d825abdc2d5226c824e62f
[3.14722] >> git log --shortstat --first-parent -m --pretty=format:"%at %aN" HEAD
git log --shortstat --date-order --pretty=format:"%at %aN" HEADerror: Could not read b7924b0488d62b9aecaead77ae47608fa172ef46
fatal: revision walk setup failed
[0.01042] >> git log --shortstat --date-order --pretty=format:"%at %aN" HEAD
Refining data...
Saving cache...
Traceback (most recent call last):
File "/usr/local/bin/gitstats", line 1424, in
g.run(sys.argv[1:])
File "/usr/local/bin/gitstats", line 1405, in run
data.refine()
File "/usr/local/bin/gitstats", line 573, in refine
self.authors_by_commits = getkeyssortedbyvaluekey(self.authors, 'commits')
File "/usr/local/bin/gitstats", line 78, in getkeyssortedbyvaluekey
return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
File "/usr/local/bin/gitstats", line 78, in
return map(lambda el : el[1], sorted(map(lambda el : (d[el][key], el), d.keys())))
KeyError: 'commits'

Shift start of year

Hi,
Thanks for gitstats.
I use git for the sources of a website dedicated to teaching. Years begin in september and end in august.
How easy it would be to add a conf option to set a starting month that would make Gistats report years as 2013-2014? Could you give some pointers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.