261 Commits

Author SHA1 Message Date
Ernesto Jiménez
aa77a8915f Fix total lines for multi-repository stats.
Make general stats total LOC show the total aggregate from all projects,
instead of the total LOC from last project.

[hoxu@users.sf.net: rewrote the commit message]

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2013-01-31 19:25:43 +02:00
Heikki Hokkanen
19e687b96e Fix cachefile corruption when out of disk space.
Avoid corrupt cache by writing it to a temporary file first, and then
overwriting the original one. Should also fix other exceptional cases.

Thanks-to: Alexander Strasser <eclipse7@gmx.net>
2012-12-17 21:44:20 +02:00
Heikki Hokkanen
e6b3058337 Document linear_linestats and project_name options. 2012-07-19 13:08:15 +03:00
Ciaran Gultnieks
380b164bc5 Added ability to merge/rename authors
There's a new config field, 'merge_authors', which is a dictionary of
source name to target name. Whenever an author name matches a source
name it will be treated as if it was the target name instead.

Use this if authors have committed under multiple names, to squash their
statistics down to a single author. You can also use it to rename an
author for the purposes of the output.

Additionally, the -c option has been extended so for a dictionary option
you specify -c field=key,value. The key,value pair is then ADDED to the
dictionary.

Putting it all together in an example:

  ./gitstats -c merge_authors=bob,Bob\ Jones    \
      -c merge_authors=bob2,Bob\ Jones          \
      -c merge_authors=erica,Erica\ Smith ....

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2012-07-19 11:57:47 +03:00
Heikki Hokkanen
09e324e3d1 Merge branch 'master' of https://github.com/svenvh/gitstats
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2012-07-17 11:39:02 +03:00
Sven van Haastregt
8b475ea3e6 Fix incorrect gitstats version.
If the VERSION variable was not filled in, gitstats would run
'git rev-parse' on the repository being examined instead of the
gitstats repository.

Signed-off-by: Sven van Haastregt <svhaastr@liacs.nl>
2012-07-15 12:39:58 +02:00
Sven van Haastregt
a9b3f0f4fe Check for gnuplot before collecting data.
This should address issue:
Check for gnuplot before running - ID: 3062202
http://sourceforge.net/tracker/?func=detail&aid=3062202&group_id=203965&atid=987711

Signed-off-by: Sven van Haastregt <svhaastr@liacs.nl>
2012-07-14 23:07:00 +02:00
Sven van Haastregt
f562f98185 Report proper gnuplot version.
If a custom version of gnuplot would be used by setting the GNUPLOT
environment variable, then still the default gnuplot was called to fill
in the gnuplot version number.

Signed-off-by: Sven van Haastregt <svhaastr@liacs.nl>
2012-07-14 23:03:19 +02:00
Heikki Hokkanen
496228fb74 Remove "total_authors = 0" fallback.
When counting authors, do not fall back to 0 if the git call fails. Zero
authors causes ZeroDivisionError later on otherwise. This reverts an old change
for msysgit on win32, introduced in a01045f2480a21f28dd90e278b4f560020a97b9e.
It should no longer be necessary.
2012-07-13 21:42:05 +03:00
Heikki Hokkanen
2e1aba41e9 Catch ZeroDivisionError in file extension stats.
Otherwise it would not be possible to generate stats for binary-only
repositories.
2012-07-13 18:07:29 +03:00
Heikki Hokkanen
75b53209da Catch ZeroDivisionError in 'Average file size'. 2012-07-13 17:49:15 +03:00
Heikki Hokkanen
910d179c5f Bump copyright year. 2012-05-28 21:43:20 +03:00
Heikki Hokkanen
4438d41363 Set LC_ALL to 'C'.
Parsing of some git outputs relies on the english language being used, so
explicitly set the locale before running any of them.
2012-05-28 21:42:14 +03:00
Alexander Strasser
464bee6a11 Parse git's diff stat summary more flexibly.
Git versions with commit 7f814632f5d4d7af9f4225ece6039dbc44e03079 print the
stat summary output slightly different. There were two changes that affect
GitStats:

a) Singular forms of files/insertions/deletions may be used
b) The number of counts is now variable ranging from 1 to 3:
   1: only files changed if file count is 0
   2: if either insertions or deletions are 0 (not if both are)
   3: where files,insertions and deletions are >0
          or both insertions and deletions are  0

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2012-05-28 21:27:40 +03:00
Alexander Strasser
4cce497e96 Calculate commit delta days with full days.
Make the units on par with active commit days. Previously a new project
committed to yesterday at 23:00 and today at 1:00 would have an age of 1 day
but 2 active days.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2012-05-25 20:19:32 +03:00
Thomas R. Koll
ad7efbb939 Fix commits per tag counting.
A hard-to-spot bug where the total number of commits for a tag was always set
to the number of commits that one of the commiters did and not the cumulated
sum over all commiters.

[hoxu@users.sf.net: created a commit from diff and description sent by Thomas]
2012-03-08 22:40:13 +02:00
Heikki Hokkanen
8aebc9ce66 Skip submodules when counting extensions and file sizes. 2011-11-20 09:50:28 +02:00
Heikki Hokkanen
204d905a9f Show sensible-browser command when running interactively. 2011-10-25 18:12:09 +03:00
Heikki Hokkanen
8b7ddc1f1d Be multirepo-compatible by not resetting total_size. 2011-10-25 17:28:47 +03:00
Kirill Chilikin
502b215425 Fixed calculation of number of files.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-10-25 17:16:20 +03:00
Kirill Chilikin
68d17b105b Fixed calculation of total size of files.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-10-25 17:16:11 +03:00
Chris Cormack
750ddfe35a Fix for KeyError being generated if a month has commits but for some reason no lines changed
Example of exception

[1.17747] >> gnuplot --version
Traceback (most recent call last):
  File "./gitstats", line 1373, in <module>
      g.run(sys.argv[1:]
  File "./gitstats", line 1365, in run
     report.create(data, outputpath)
  File "./gitstats", line 841, in create
     f.write('<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td></tr>' % (yymm, data.commits_by_month[yymm], data.lines_added_by_month[yymm],
   data.lines_removed_by_month[yymm]))
KeyError: '2010-08'

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-09-28 19:27:06 +03:00
Karel Rank
2acf4392ad Add statistics about changed lines in time
Stats are calculated for months of year and years. Activity page in
sections 'Commits by year/month' and 'Commits by Year' are enhanced by
this statistic.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-09-21 19:34:12 +03:00
Stefano Mosconi
c3d67a7e5b Fixing commit_begin conf option
If you tried to pass only -c commit_begin=something this would
always return HEAD in any case since commit_end was set to ''.

Defaulting commit_end to HEAD makes getcommitrange() function work as it
should.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-04-08 22:41:25 +03:00
Heikki Hokkanen
09f1307a85 Do not consider a dot in path a filename extension.
'highlight.js/LICENSE' was recognized as 'js/LICENSE' extension erroneously.

Fixes SourceForge bug #3221520.

Thanks-to: Alexander Gladysh <agladysh@users.sourceforge.net>
2011-03-21 19:46:09 +02:00
Heikki Hokkanen
04d459ac81 todo: updated. 2011-02-18 17:33:36 +02:00
Matthieu Moy
f1ab9e8373 Don't create ugly graphs on clock skew
We collect and accumulate data based on the order of the output of "git
log", which is not necessarily ordered by timestamp. Adding --date-order
should improve the situation, but isn't sufficient at least on git.git's
repository.

In addition, when encountering a date that is prior to the last one
encountered, we change it to be the last encountered date. A better
solution would be to actually order the lines before starting to count.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-19 18:25:48 +02:00
Heikki Hokkanen
3f0bcc6871 Remove debug print. 2011-01-19 18:07:51 +02:00
Heikki Hokkanen
5722b75c2b Fix author active days calculation.
A set of dates is used now instead of an incremented value. This is the same as
what has been used for General -> active days already.
2011-01-19 17:24:29 +02:00
Heikki Hokkanen
377e7f32e5 Fix first/last commit finding.
Because of cherry-pick and patches, commits may be in any order. This also
improves the support for generating statistics for multiple repositories.
2011-01-18 19:46:46 +02:00
Heikki Hokkanen
19588b9302 Make negative author timedelta positive.
Commit timestamps can be in backwards order (when applying patches &
cherry-picking in reverse order), so we don't want author age to be negative
(was in gitstats case too :)
2011-01-17 20:02:00 +02:00
Heikki Hokkanen
bfd32fdce1 Trivial change to Wulf's patch. 2011-01-17 20:01:25 +02:00
Wulf C. Krueger
beaf16168a Initial changes for multi-repo awareness.
Initial attempt to make gitstats create cumulative statistics for multiple
repos (the case of a single project consisting of more than just one git
repository.)

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-17 19:48:54 +02:00
Heikki Hokkanen
6283b0e5b0 Cleanup: whitespace changes & removed extra ';'. 2011-01-17 19:37:30 +02:00
Heikki Hokkanen
079ed2c866 Bump copyright year. 2011-01-17 18:35:51 +02:00
Matthieu Moy
a554942c01 Per-author commit count graph
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-16 11:03:02 +02:00
Matthieu Moy
591bad8ac2 Per-author added lines graph
Old versions of gnuplot produce garbage if the author's name contain
non-ascii, but gnuplot 4.4 seems to handle it just fine.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-16 11:02:53 +02:00
Matthieu Moy
117165dd5f Don't compute per-author information with --first-parent
While it's fine to compute project-wide informations (LOC) on a linear
history, we don't want to assign added lines of code to the user doing
a merge when the code was initially written by someone else on a
branch.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-16 10:56:46 +02:00
Heikki Hokkanen
e9a527cb8c Include git and gnuplot version on general page. 2011-01-15 09:00:32 +02:00
Matthieu Moy
872bbedab7 Portable syntax for "set xtics rotate"
Gnuplot version 4.4 renders text within the drawing area with "set
xtics rotate angle 90". According to

http://newsgroups.derkeiler.com/Archive/Comp/comp.graphics.apps.gnuplot/2010-08/msg00079.html
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586513

this is a feature, not a bug, but "set xtics rotate" give the expected
behavior everywhere (text from down to top, below the graph).

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-14 23:07:03 +02:00
Matthieu Moy
5bebafd179 Set image size with "set terminal size", not "set size".
Recent versions of gnuplot understand "set size" as the amount of
space to use within the canava size. "set size 1,0.5" was therefore
creating large images with the top half being blank.

set terminal size works as expected at least with gnuplot 4.4 and 4.2.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2011-01-14 23:05:23 +02:00
Heikki Hokkanen
db7fa31293 README: s/GPLv2 or older/GPLv2 or later/.
gitstats is dual-licensed under GPLv2/GPLv3, so naturally the contributions are
asked to be GPLv2+.

Thanks-to: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
2011-01-10 20:44:52 +02:00
Heikki Hokkanen
8c0032c63b Make project name configurable (-c project_name=foo). 2011-01-08 11:03:51 +02:00
Heikki Hokkanen
5662647332 Wrap run() inside if __name__. 2011-01-08 10:44:19 +02:00
Heikki Hokkanen
5e11dfbe32 Fix running gitstats with a non-tty stdin.
The following command used to fail because git shortlog has some witty magic to
decide the behaviour based on whether stdin is a terminal:

./gitstats /repo /dst < /dev/null

effectively causing a lot of shell scripts calling gitstats to fail with
"Division by zero" in author statistics.

Thanks-to: Bertrand Jacquin <beber@meleeweb.net>
Thanks-to: Sylvain Rabot <sylvain@abstraction.fr>
2010-10-20 22:14:47 +03:00
Heikki Hokkanen
0656ac9578 Add a new option 'linear_linestats' (default on).
When enabled, the lines of code statistics are collected from linear history.
The downside is that commits of feature long feature branches appear only at
the point where a merge commit is made.

If disabled (old behaviour), the problem is that if two branches contain the
same changes (for example, removal of same lines), the statistics get skewed.

Fixes line count statistics for this example repository:
git://github.com/septract/jstar.git

Thanks-to: Radu Grigore <radugrigore@users.sourceforge.net>
2010-10-17 20:27:21 +03:00
Pekka Enberg
dc0bbb2957 Use perl for version number replacement.
This patch changes Makefile to use perl for version number replacement to fix
'make install' on Darwin. The problem is that GNU sed and sed on Darwin (and
probably on BSDs) behave differently with regards to the '-i' command line
option.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-09-28 18:04:46 +03:00
Heikki Hokkanen
9473138e28 Cover options in the manpage. 2010-08-07 10:25:36 +03:00
Heikki Hokkanen
70c7bd5ccc Add a simple manpage.
The manpage is in pod format, and pod2man can be used to convert it.
2010-08-07 10:06:55 +03:00
Heikki Hokkanen
e98d2c9350 Commits by Domains: start yrange from 0.
Will show more truthful graphs when all domains have a lot of commits.
2010-07-23 22:20:29 +03:00