Commit Graph

149 Commits

Author SHA1 Message Date
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
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
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
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
Wulf C. Krueger
1e70f827af Fix potential KeyError with 'lines_added' in 55e46db.
[hoxu@users.sf.net: rewrote commit message]

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-07-02 14:36:08 +03:00
Bo Ørsted Andresen
55e46db71b Respect .mailmap.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-06-23 16:38:42 +03:00
Heikki Hokkanen
2c38acfd05 Raise KeyError instead of a string exception.
Fixes debian bug #585225:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585225
2010-06-10 07:51:50 +03:00
Heikki Hokkanen
bb75f25beb Add options for limiting stats to begin..end range.
Bit hackish and not fully supported, but -c commit_end=HEAD~10 allows limiting
statistics generation to before HEAD~10 for example.
2010-06-08 16:56:38 +03:00
Heikki Hokkanen
cc0f94fd1a Remove extra 'git log' call.
No idea why this was used in the first place, apart from performance hit, it
had no effect.
2010-06-08 16:27:11 +03:00
Heikki Hokkanen
c74f099913 Show average number of commits per author. 2010-04-02 16:12:01 +03:00
Heikki Hokkanen
1567223e98 Show number of authors for each month/year. 2010-04-02 16:07:38 +03:00
Heikki Hokkanen
8bffbaa87e Make "Next top 5" configurable.
"-c authors_top=N" changes how many authors are shown on "Author of month" and
"Author of year".
2010-04-02 16:06:24 +03:00
Tyler Nielsen
6f5314e993 Properly handle empty commits with no changes.
Clear files, inserted and deleted after storing them for the preceding commit.

git-svn, for example, can have empty commits (when a directory is created),
causing the statistics to get skewed.

[hoxu@users.sf.net: rewrote commit message based on Tyler's mail]

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-03-24 07:03:58 +02:00
Tyler Nielsen
1dd89a2322 Open the cache in binary mode.
This fixes an issue where the cache fails to load on Windows machines.
EOL characters were getting modified, causing zlib uncompression to fail.

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

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-03-24 06:58:56 +02:00
Tobias Gruetzmacher
cef3478bec Name weekdays.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-02-27 12:55:43 +02:00
Wulf C. Krueger
d2b5b32071 Don't revert getAuthors' sorting by commits by sorting again.
getAuthors sorts by commits, sorting it again negates that and instead
sorts the list alphabetically again which kind of defeats the purpose.

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
2010-01-18 19:09:11 +02:00
Wulf C. Krueger
b54e19c8c0 Activate grids on y for all graphs.
Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>

[hoxu@users.sf.net: removed some unrelated changes]
2010-01-18 18:49:28 +02:00
Heikki Hokkanen
572c2b774f Don't choke on one day old repositories. 2010-01-17 09:26:05 +02:00