Commit Graph

58 Commits

Author SHA1 Message Date
Adam Waldenberg 983d3d05bd When generating the report, summed changes need to be non-empty (#132).
Previoulsy, we were just checking against the changes returned from the
last repository analyzed - which of course broke the whole thing if that
repository had no matching commits!
2017-05-13 15:39:38 +02:00
Adam Waldenberg 9f336e63ce Faulty clone code made it possible to run gitinspector in sub-directories.
This resulted in undefined behavior. The base directory was being
incorrectly defined when cloning did not occur.
2017-05-12 15:31:28 +02:00
Adam Waldenberg ecc67a31a5 Repositories are now merged with __iadd__() instead of __add__().
Thus, we are overriding the "+=" operator instead of "+". This
implementation results in a much cleaner solution as we were directly
updating "self" when overriding __add__(), something which isn't really
an acceptable solution as we were changing the supplied in-parameters.
2015-11-25 17:28:50 +01:00
Adam Waldenberg 9ada057d81 Progress output now includes repository name (#24).
The name of the repository is only printed when multiple repositories
are specified. Otherwise, gitinspector falls back to the previous
behavior
2015-11-02 18:22:56 +01:00
Adam Waldenberg d5106a7302 Implemented validation and printing of all supplied repositories (#24).
Upon start-up, now directly passes all supplied paths to git in order
to check if all of them point to a valid git repository.

The clone.create() function now returns a list of Repository instances,
containing the name and location of the repository. This is later
used in the gitinspector module to execute and parse the repository.

format.output_header(...) now takes a list of Repository instances.
Thanks to this, each output format can print every supplied repository.
2015-11-02 02:30:28 +01:00
Adam Waldenberg 802f18e7e5 The metrics module now supports multiple repositories (See issue #24). 2015-11-01 03:36:40 +01:00
Adam Waldenberg 98615ccbfc Support for multiple repositories is near completion (See issue #24).
Only the metrics module is lacking support. While the rest should work,
please note that it is completely untested as of now and probably
has some rough edges.
2015-10-31 05:10:00 +01:00
Adam Waldenberg 46b21db196 The changes module now supports multiple repositories (See issue #24).
Just as before, all other parts of gitinspector currently do not
support fetching statistics from multiple repositories and just
simply fetch data from the last repository specified.
2015-10-31 03:44:00 +01:00
Adam Waldenberg dd2feedbe4 Fixed invalid indentation at begining of file in gitinspector.py. 2015-10-30 23:54:04 +01:00
Adam Waldenberg e0941fdcf1 The gitinspector.py entry module now considers all repositories.
While they are considered, they are not yet being merged. Statistics
are only calculated for the last repository passed.

This is being done in preparation of completing issue #24.
2015-10-30 23:46:13 +01:00
Adam Waldenberg 109a94e1e7 The basedir module is no longer persistent (doesn't remember state).
This is required in order for it to be callable multiple times for
multiple repositories (Needed for #24).
2015-10-30 23:29:03 +01:00
Adam Waldenberg d88ff2c5b9 Slight cleanup in gitinspector.py.
Renamed all "local" declarations in main().
2015-10-30 03:41:09 +01:00
Adam Waldenberg c01a59430c Rewrote the config module into a class (GitConfig).
This class takes the initialization variable "global_only" which
will be set in the future whenever multiple repositories are
specified (See issue #24).

This will make sure that the git configuration is only read from the
global settings instead of per-repository.
2015-10-30 01:24:33 +01:00
Adam Waldenberg 1ed9b5e3cf Re-factored the changes module and made it more independent.
This will make it easier to add support for the merging of statistics from
multiple repositories (as discussed in issue #24).
2015-10-29 03:09:46 +01:00
Adam Waldenberg bbe07f061d Added support for JSON output format (Fixes #50). 2015-10-24 02:44:45 +02:00
Adam Waldenberg 124636cb85 Restructured imports slightly. 2015-10-21 05:26:20 +02:00
Adam Waldenberg e9eab37c83 Added a new gitinspector.py entry script. 2015-10-21 05:07:47 +02:00
Marc Harper 9abb9b3d56 Relative imports to fix packaging issues 2015-10-20 09:40:08 -07:00
Adam Waldenberg f2a4cb92d3 Always append the root gitinspector package to sys.path (Fixes #73).
With this change, gitinspector once again functions in conjunction with
egg installations. Also removed all forceful absolute imports, as these
really aren't needed.
2015-10-15 17:01:57 +02:00
Adam Waldenberg 1f2f120389 Fixed pylint violations reported by a newer version of pylint. 2015-10-12 03:15:30 +02:00
Adam Waldenberg 34337dec17 Refactored all outputable modules.
This prepares the source code for the changes discussed in issue #24.

Note that this is just a quick restructuring in order to see the resulting
classes and separation. More work will be done to make it more elegant
and with less dependencies between modules.
2015-10-12 03:03:07 +02:00
Adam Waldenberg 5259b76b94 The localization module now warns when finding an out of date translation.
While allowing us to include translations that are not quite up to date
with the current development branch in releases, it also serves to inform
the user that they are using a translation that is broken or incomplete.
2015-10-09 03:02:06 +02:00
Adam Waldenberg 38df413ebf Global cleanup fixing some pylint violations. 2015-10-05 06:17:10 +02:00
Diomidis Spinellis bc5b0abe74 Remove assumption of Python path.
For example, on a FreeBSD system Python can be installed in
/usr/local/bin/python.

Some systems have multiple interpreters installed in a variety of
locations.  The attached patch corrects the problem by using the
env(1) command to run Python.

Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-03 10:19:04 +01:00
Adam Waldenberg 12e08daf72 Moved absolute path detection into the basedir module.
The base name of the returned absolute path is also the name of the
repository from which the statistics were gathered. We will use this in
the generated reports.
2014-02-20 03:49:16 +01:00
Adam Waldenberg a1e90d0a9d The age value of the blame output now listens to the --weeks flag.
Consequently, the age value now shows the average age of all the rows
blamed to an author in months (or weeks when --weeks/-w is used).
2014-02-14 05:25:14 +01:00
Adam Waldenberg a45df61aa9 Implemented support for remote repositories (Fixes issue 18).
The supported protocols are file://, git://, http://, https:// and ssh://.

Whenever one of the above prefixes are detected in the repository name,
"git clone" is used to clone the repository into a temporary directory.

When "git clone" is called, it's output is redirected to stderr; meaning
that redirection of stdout to a file functions just as before.

If "git clone" fails for some reason, gitinspector will exit; returning
the error code from the "git clone" command.
2014-01-21 12:14:13 +01:00
Adam Waldenberg 23bc5fbbea Print a warning when the terminal encoding is not set (Fixes issue 19).
This fix also sets the stdin encoding to UTF-8 whenever it is not set.
The behavior as the same as the one for stdout.
2014-01-08 06:05:10 +01:00
Adam Waldenberg 2633e04c3a Completed the support for bare repositories (Fixes issue 14).
With the missing module now gone, only a few minor modifications were
needed to get it working.
2013-08-03 10:34:45 +02:00
Adam Waldenberg bc182c6924 Completely removed the missing module and the --checkout-missing option.
This is flag should not be needed anymore, as gitinspector always uses
a reference point such as HEAD or some reivision when looking into the
repository (never the file structure directly).
2013-08-03 10:30:43 +02:00
Chris Ring 00fdec2928 Initial support for bare repos.
Signed-off-by: Chris Ring <chris@ringthis.com>
Reviewed-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2013-08-03 09:55:44 +02:00
Adam Waldenberg 353f8daee1 BlameOutput no longer takes an object of a Changes class as argument.
This is unnecessary as there is a get() function inside the changes module
to fetch an object of this class, so we can fetch this directly in
BlameOutput.__init__().
2013-07-25 14:37:19 +02:00
Chris Ring 92ef11fa20 Fix typo in error message.
The error message when using an incompatible version of
Python contains a typo.

Signed-off-by: Chris Ring <chris@ringthis.com>
Reviewed-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2013-07-25 09:03:03 +02:00
Adam Waldenberg 66b63a6f0e The "-m" flag was being mistaken as "--checkout-missing".
This was because of the use of the "in" operator during processing of the
incoming options and arguments.
2013-07-24 09:06:30 +02:00
Adam Waldenberg 35852f9859 Added support for gravatars in the changes, blame and timeline modules.
References to gravatar images are generated with HTML and XML outputs only
as these are the only formats where referencing gravatars makes sense
right now. The HTMLEmbedded format, for example, does not link to any
gravatars as that format prohibits the use of external links.

To accommodate the new images; the width of the generated HTML page has
been slightly increased. However, the HTML page should still fit on a
1280 display.
2013-07-20 11:45:11 +02:00
Adam Waldenberg c91b8cc704 Output is now written to stderr when an exception is caught. 2013-07-15 04:48:25 +02:00
Adam Waldenberg 064a2e11b8 Added InvalidRegExpError in the filtering module.
This is a better solution than simply relying on ValueError and also
helps us to maintain compatibility with all our other exceptions (it gives
us a msg attribute that we can access when catching the error).

Also localized the string for InvalidRegExpError.
2013-07-14 12:19:31 +02:00
Adam Waldenberg adf6ee412f -x and --exclude options now clear the filtering rules when first found.
This behavior is preferred in order for us to be able to override any
exclude filter set via git-config.
2013-07-14 04:29:00 +02:00
Adam Waldenberg 3a34be0d06 Added missing "--checkout-missing" long option to gitinspector module. 2013-07-14 04:15:41 +02:00
Adam Waldenberg b28d86d1f2 Fixed a long-standing bug with exceptions not being able to handle unicode.
This was fixed by storing the exception string manually inside each
exception class. The error message is now stored in exception.msg instead
of relying on __str__(). It seems the normal behavior (by printing exceptions
directly) is broken in Python 2. It *does* work in Python 3, but this is
because it always handles everything as unicode.
2013-07-14 03:15:14 +02:00
Adam Waldenberg 5c9335088a Command-line arguments are now always converted to UTF-8 before use. 2013-07-14 03:10:00 +02:00
Adam Waldenberg 7f0e2b6fe8 Changed the argument parsing back to using getopt!
The support for optional boolean arguments is the same; but uses
getopt instead of optparse.

The whole adventure with optparse was a giant waste of time and just
forced us to monkey-patch optparse with some very ugly solutions in order
to make it do what we wanted; thus it was better to switch back to the
more low-level getopt module.

To accomplish this; a optval.gnu_getopt() function was added that is a
duplicate of the original getopt.gnu_getopt function but with support for
optional arguments.

A long option which accepts an optional argument is denoted with
arg:default_value in the long_options string.

In the end, this solution feels much better than the one with optparse.
2013-07-14 00:07:36 +02:00
Adam Waldenberg c073e32dbe Hacked optparse (yet again) to force it to play nice with unicode flags.
Previously, whenever a flag had unicode characters in it; it would all
completely blow up.
2013-07-12 03:36:03 +02:00
Adam Waldenberg f4b10ce15f Moved unicode function declaration to a compatibility module.
This is used (as the name suggests) for compatibility between Python 2 and
Python 3.
2013-07-12 03:33:13 +02:00
Adam Waldenberg 8edd72a609 gitinspector now exits if it fails to change directory to the repo root. 2013-07-10 16:58:06 +02:00
Adam Waldenberg aeb55c5a3e Fixed a potential encoding issue when printing exception messages. 2013-07-10 16:45:12 +02:00
Adam Waldenberg 2df9a31b60 gitinspector now finds the absolute path of the git directory.
If gitinspector was not executed standing in the root directory of the
git repository (or with a git root specified at the command line),
"git ls-tree" would not find all files properly.
2013-07-10 14:23:11 +02:00
Adam Waldenberg 3b82acdfa1 Added a --localize-output flag.
The default behaviour is now not to localize the output, only the help
text and error messages (all the user interaction).

The way localized messages are fetched in the modules has been modified
as well; to allow for the ability to enable and disable the localization.
2013-07-10 05:24:18 +02:00
Adam Waldenberg 109fefb978 Fixed some small mistakes in relation to handling of git-config settings. 2013-07-10 03:32:29 +02:00
Adam Waldenberg a05403df60 Added localization support to optparse error messages.
The optparse module does not seem to support this by default. The solution
is not very pretty, but it works.
2013-07-10 03:11:15 +02:00