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!
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.
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.
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.
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.
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.
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.
With this change, gitinspector once again functions in conjunction with
egg installations. Also removed all forceful absolute imports, as these
really aren't needed.
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.
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.
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>
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.
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.
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).
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__().
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>
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.
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.
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.
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.
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.
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.