Commit Graph

279 Commits

Author SHA1 Message Date
Adam Waldenberg f368c0019a Fixed mistake in the filtering module related to hash filtering.
FILTERING_EMAIL_INFO_TEXT was erroneously being defined twice.
2015-09-22 02:41:16 +02:00
Adam Waldenberg 5a18732112 Added missing file close() in blame module. 2015-09-20 01:43:40 +02:00
Adam Waldenberg b4b48deebd Printed extensions (-l) are now alphabetically sorted. 2015-09-20 01:42:54 +02:00
Adam Waldenberg aeb9ad69f9 Implemented threading in the changes module (Fixes #15).
This change results in a substantial speed up.
2015-09-19 04:32:02 +02:00
Adam Waldenberg f37bdb7c58 Bumped the version number to the next development iteration. 2015-09-08 02:03:11 +02:00
Adam Waldenberg f6fd00f411 Bumped the version number to 0.4.1. 2015-09-08 02:02:21 +02:00
Adam Waldenberg 124ca74650 HTML output was broken when authors with quotes were sent to JavaScript.
Fixed by using json.dumps() to escape the author name before passing it to
the JavaScript output.
2015-09-08 01:35:42 +02:00
Adam Waldenberg 98c375a0ab Fixed bug indirectly introduced with commit 0447da19.
When reversing the git log, we forgot to take the interval into
consideration; breaking the --since and--until flags.
2015-09-07 02:22:58 +02:00
Adam Waldenberg b48c65efb1 All subprocess.Popen calls now use the list variant.
Most (all?) hard coded quotations have been removed in favor of automation
and the pipes or shlex modules.
2015-09-07 01:53:24 +02:00
Adam Waldenberg c5e861d662 Bumped the version number to the next development iteration. 2015-09-05 10:25:08 +02:00
Adam Waldenberg ade7a5ad9b Bumped the version number to 0.4.0. 2015-09-01 02:58:00 +02:00
Kamila Chyla 96e2b0fdf0 Prevent ZeroDivisionError in get_stability method (Fixes #63).
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2015-08-25 02:23:46 +02:00
Adam Waldenberg 30a20e6b52 All doc and source code URL's now also point to the new home on GitHub.
Regenerated all the documentation from the AsciiDoc document.
2015-08-24 17:34:14 +02:00
Adam Waldenberg 4803c511df Updated invalid year strings in version information. 2015-08-24 17:23:54 +02:00
Adam Waldenberg 02b6db512b Strip exotic characters from the table-sorter plugin.
This is needed under certain circumstances whenever the terminal locale
can't be determined and can't handle unicode characters.
2015-02-22 00:53:38 +01:00
Adam Waldenberg de602bb70f Added workaround for missing LANG environment variable (Fixes issue 55). 2015-02-16 16:10:12 +01:00
Kamila Chyla 6c45819a62 Updated Polish translation.
Update issue 16
Status: Done
2014-12-30 09:10:32 +01:00
Adam Waldenberg 568a5e5e8b Fixed the terminal column alignment for languages with multi-column chars.
This is for example needed for the Chinese and Korean translations to work
correctly when using terminal output.
2014-12-19 03:02:08 +01:00
Adam Waldenberg b327238496 Fixed a mistake in the Swedish translation.
The translation for the cyclomatic complexity string was using the wrong
format.
2014-12-19 02:59:50 +01:00
Adam Waldenberg 1230fcf80c Changes.get_latest_author_by_email() was broken under Python 3.
This is because of the patch committed with revision 68a6e90228. As
Python 3 stores unicode strings by default, we need to convert them back.

This change will hopefully fix it once and for all.
2014-12-18 04:30:04 +01:00
Adam Waldenberg eed6d0debf localization.get_date() was failing with unicode characters under Python 2.
Fixed by adding a simple decode call.
2014-12-18 04:07:28 +01:00
Adam Waldenberg 8c464fddd4 Some minor tweaks to the German translation. 2014-12-08 11:18:34 +01:00
Philipp Nowak a42726aedb Added German translation.
Update issue 25
Status: Done
2014-12-08 03:41:41 +01:00
Bill Wang e169421fa9 Updated Chinese translation (Fixes issue 11). 2014-12-07 11:27:19 +01:00
Dmitry Dzhus c6928bd675 Recognize Haskell (.hs) comments (Fixes issue 49).
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-12-07 11:03:51 +01:00
Luca Motta cbed2ac13f Updated Italian translation.
Update issue 20
Status: Done
2014-12-03 12:12:39 +01:00
Yannick Moy 2ca997cc9d Added French translation.
Update issue 38
Status: Done
2014-11-30 10:18:18 +01:00
Adam Waldenberg e703856560 The Swedish translation had 2013 instead of 2014 in it's version text. 2014-11-30 10:09:00 +01:00
Adam Waldenberg b22d614849 Recognize comments in .po and .pot files. 2014-11-29 07:01:24 +01:00
Adam Waldenberg 4d6e51a760 Updated the locale template (.pot) and the Swedish translation.
A number of new strings have been added since the last version.
2014-11-29 06:37:34 +01:00
Adam Waldenberg 26e2ce7c07 Added help text (--help) for the new revision filtering. 2014-11-29 06:35:07 +01:00
Adam Waldenberg bc6be1c56f Fixed some pylint violations. 2014-11-27 12:38:58 +01:00
Adam Waldenberg bc9fd8b207 Localized error message in the basedir module. 2014-11-27 12:16:42 +01:00
Adam Waldenberg d315829e9d Added commit filtering by revision (Fixes issue 33).
Specific commits can now be filtered by using;

-x, --exclude="revision:<SHA-1>"

Like with all other filtering in gitinspector, regular expressions are
supported. Likewise, multiple revisions can be specified using a comma or
by simply supplying multiple exclude parameters.

As usual, both the commit module and blame module take this filtering into
account.
2014-11-27 08:39:17 +01:00
Adam Waldenberg 8755fb33dc Doesn't start when using "C" locale (Fixes issue 29). 2014-11-24 09:36:11 +01:00
Christian Kastner 3010359eb2 Add missing html.footer to htmlembedded output (Fixes issue 48).
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-23 01:37:18 +01:00
Adam Waldenberg dd50994f2c The metrics module was failing on paths with spaces (Fixes issue 47). 2014-11-21 02:55:29 +01:00
Christian Kastner e3b4857eb6 Gracefully handle non-git-repo path (Fixes issue 44).
Error out gracefully when gitinspector is called with a path that does not
point to a git repository, instead of printing a stack trace.

Signed-off-by: Christian Kastner <debian@kvr.at>
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-20 03:41:08 +01:00
Jon Warghed 68a6e90228 Handle escaping in get_latest_author_by_email() (Fixes issue 46).
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-19 07:46:07 +01:00
Adam Waldenberg 1d2fd619bd Fixed a special and unique KeyError exception that could occur.
This is because of a mismatch between the changes module and the
blame module. Seems to be triggered by empty rows in source files.
2014-11-06 10:46:23 +01:00
Adam Waldenberg fa5e5411f5 Fixed problem with the new email detection patch. 2014-11-03 11:02:06 +01:00
Yannick Moy 12dce7f365 Recognize comments in Ada and OCaml.
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-03 10:34:46 +01: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
Diomidis Spinellis b20f15e794 More stable author email extraction.
The email search regular expression in the git-blame output can be tripped
by a similar pattern appearing in the source code. The supplied patch
fixes the problem.

Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-03 10:12:44 +01:00
Chris Barry d6a2f33de5 Use https where possible.
Signed-off-by: Adam Waldenberg <adam.waldenberg@ejwa.se>
2014-11-03 09:56:49 +01:00
Adam Waldenberg 7b61a46d7c The blame chart legend now shows the correct colors (Fixes issue 26).
To also correctly update the legend of the chart, a call to setupGrid()
(in Flot) seems to be required.
2014-07-04 01:37:58 +02:00
Adam Waldenberg 93b18cdd9a The name of the project is now shown in the title of the HTML output.
Moved the gitinspector version number from the title down to the top text
box of the HTML page.
2014-03-17 08:47:49 +01:00
Adam Waldenberg 722ca9b91a The HTML output of the metrics module now shows violation severity.
This is accomplished by color coding the rows of the violations in the
following manner:

minimal violations: light green
minor violations:   green
medium violations:  yellow
bad violations:     light-red
sever violations:   red

Naturally, the zebra coloring of the rows is still being maintained.
2014-02-26 13:53:11 +01:00
Adam Waldenberg 144303dab6 The metrics module cyclomatic complexity density now limited to 3 decimals. 2014-02-26 11:57:43 +01:00
Adam Waldenberg 6052eb5646 Fixed XML output of the metrics module. Also reworked the indentation. 2014-02-26 11:54:23 +01:00
Adam Waldenberg 232e041861 Did some visual improvements to the HTML output of the metrics module.
Each metrics section now has a header with proper coloring. Furthermore,
every other row of the outputted violations are colorized in order to
improve readability.
2014-02-26 11:43:57 +01:00
Adam Waldenberg efe04cc10b Added cyclomatic complexity output to the HTML and XML output formats.
More of the strings in the metrics module are now also localized.
2014-02-25 06:08:26 +01:00
Adam Waldenberg f85c2fe7b4 Removed height adjustment from the HTML body. This isn't needed anymore. 2014-02-24 14:15:37 +01:00
Adam Waldenberg b2528cfda7 Fixed horizontal centering of the header in the HTML output. 2014-02-24 14:14:02 +01:00
Adam Waldenberg fac4b34646 Fixed invalid function call in the responsibilities module. 2014-02-20 21:03:00 +01:00
Adam Waldenberg 9b2aecc3e9 Added support for cyclomatic complexity to the metrics module.
The calculation is rather simple and is not meant to be a reflection of
McCabes's cyclomatic complexity number. Instead, it is an approximation,
implemented in a more general way and supporting many different languages
through the use of regular expression matching.

The initial languages supported in this metric are: Java, JavaScript, C,
C++ and Python.

If anyone needs support for some other language, patches to the metric
module (metrics.py) are welcome.
2014-02-20 20:57:57 +01:00
Adam Waldenberg 786a44ddbc Fixed a newly introduced bug in the resonsibilities module.
The blame module was being called with too few arguments, causing an
exception.
2014-02-20 04:08:05 +01:00
Adam Waldenberg 4e4d0a2ddb The repository name and report date is now included in the generated text. 2014-02-20 04:06:47 +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 0447da1933 The git log is now read in reverse order.
This makes sure that the most recent email of an author is always used when
generating the gravatar. It also makes sure that the mappings between
author<->email are correct (and recent).
2014-02-19 06:36:06 +01:00
Adam Waldenberg e902f7b82d Fixed possible exception occurring during stability value gathering.
For now, we return 100 % whenever an author is not found to have any
entries in the changes log. This can happen whenever an author uses the
same email but with different author names.

The solution would probably be to consider these commits to belong to the
same person and merge the results.

This will require some additional changes to the code and a redesign in
the way that author names and emails are mapped.
2014-02-19 06:33:17 +01:00
Adam Waldenberg 02e0858985 The two generated pie graphs now use the same colors (Fixes issue 26).
The same author should have the same color in the two graphs, something
that is more consistent and logical.
2014-02-14 17:26:26 +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 16154cd0ba Added age value to the blame output (Fixes issue 10).
This completes the "code stability" functionality.

While code stability is a percentage (zero and up) that reflects the
stability of the authors code, the age value is a pseudo-value describing
the average age of all the authors rows. The older the code, the higher
the value.

Code stability can sometimes be above 100%, depending on the way git
calculates insertions and blamed rows.
2014-01-27 03:11:15 +01:00
Adam Waldenberg 98e3f45d65 Added stability value to the blame output. 2014-01-26 02:49:31 +01:00
Adam Waldenberg d99e8cb58d The help text now talks about repositories instead of directories.
This makes more sense now that gitinspector supports remote repositories
in addition to repositories in the local file system.
2014-01-22 00:46:14 +01:00
Adam Waldenberg d8bdbe9f6f Fixed broken header in optval module. 2014-01-22 00:24:22 +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 974be06f2b Bumped the version number to 0.3.2. 2014-01-15 13:30:15 +01:00
Adam Waldenberg 2b4e6bb111 A newline was missing in the blame output when redirecting stdout. 2014-01-15 13:26:36 +01:00
Kamila Chyla 49c80184e2 Added Polish translation (Fixes issue 16). 2014-01-15 11:17:16 +01:00
Bill Wang f834fc613e Updated Chinese translation (Fixes issue 11). 2014-01-15 11:11:36 +01:00
Adam Waldenberg 1269df639e Part of the help text in the Italian translation was wider than 80 chars. 2014-01-15 10:09:32 +01:00
Adam Waldenberg 37c295186c The --version flag now outputs the correct years (2012-2014).
This also required a small update to all the (up-to-date) language files.
2014-01-15 10:04:46 +01:00
Luca Motta 949d73a4b4 Added Italian translation (Fixes issue 20). 2014-01-13 17:40:17 +01:00
Adam Waldenberg 8d9d73549c Updated the locale template (.pot) and the Swedish translation.
As soon as the rest of the languages get updated with the new (and
modified) strings from the .pot file, we should be able to tag a new
release.
2014-01-13 13:42:04 +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 bc00f9731b Fixed some pylint violations in the filtering module. 2014-01-08 04:17:25 +01:00
Adam Waldenberg af7840be81 Added .cc and .hh to the list of default extensions scanned. 2014-01-08 03:51:02 +01:00
Adam Waldenberg a1d83ead9e Added support for comments in .hh files. 2013-12-05 08:47:20 +01:00
Adam Waldenberg abbeed5356 Added support for comments in .cc files. 2013-12-05 08:42:25 +01:00
Adam Waldenberg 37d78ff992 Updated the help command to show information on author/email filtering. 2013-10-30 03:07:45 +01:00
Adam Waldenberg 1a828136b5 Added support for comments in .scala files. 2013-10-28 02:10:09 +01:00
Adam Waldenberg 998ec7456f Added support for comments in .jspx and .xhtml files. 2013-10-25 19:28:31 +02:00
Adam Waldenberg 791e9e39dd Removed unnecessary print in the blame module.
This print should only be enabled in any "interactive format", such as the
terminal (text) output.
2013-09-17 11:56:48 +02:00
Adam Waldenberg e263982806 Progress text of the blame module was being outputted wrong.
Some regression occurred in a previous commit as the progress text never
was purged out of the output.
2013-09-17 11:53:57 +02:00
Adam Waldenberg cf0f40cc4d There was a mistake in the calculation of comments in the blame module.
Whenever filtering of author or email was enabled, problems could arise
when calculating comments percentage. Did some reshuffling of the logic;
resolving it.
2013-08-13 19:26:14 +02:00
Adam Waldenberg c96d3c3ffe The blame module was not behaving quite right when used with "--since".
It was not taking the caret (^) character into consideration when --since
was being specified, something which resulted in an excess of attributed
rows.

With this easy fix, the behavior should now be "correct".
2013-08-13 15:26:42 +02:00
Adam Waldenberg e7d69d78aa Removed some "#!/usr/bin/python" entries that sneaked into a few files.
This entry should only be present in gitinspector.py (our entry point).
2013-08-08 07:10:04 +02: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 a4a0e409a2 Filtering rules can now be separated by a comma.
Instead of specifying -x (or --exclude) multiple times, it is possible to
specify multiple filtering rules by separating each rule with a comma (,)
character. This enables the new support for filtering authors and email to
work in conjunction with git-config.

As a side effect, this means that we reserve the comma character for
internal use in gitinspector and that it can't be used in any regular
expression or filtering rule. However, this is not a big problem.

Of course, specifying -x multiple times (like before) is still supported.
2013-08-03 09:41:21 +02:00
Adam Waldenberg 1edae66fee Added filtering of commits from specific authors or emails (Fixes issue 5).
To access this functionality; the -x flag can now be called in the
following ways:

-x file
-x file:<file>
-x author:<author name>
-x email:<email>

Just passing -x file will presume that the filtering rule is intended for
a file (just like the previous behavior).

All the filtering is case sensitive (even filtering by email) in order to
not break any regular expressions used. Case-insensitive matching can
instead be easily achieved with the appropriate regular expression.

To get reversed filtering (excluding everything not matched within -x) a
regular expression with the a syntax such as '^(?!<rule>)' can be used.
2013-07-30 06:32:58 +02:00
Adam Waldenberg af29a59c3c Bumped the version number to 0.3.1. 2013-07-29 12:19:42 +02:00
Adam Waldenberg b219937abe Fixed compatibility with Python 3 in the gravatar module. 2013-07-28 00:13:45 +02:00
Adam Waldenberg 20d82273ec Generated pie charts in HTML view now handle re-sizing better.
This is accomplished with the use of the flot re-size plugin. Thanks to
this, pie charts no longer have to be set to a fixed size.
2013-07-27 23:48:34 +02:00
Adam Waldenberg 6c4823aa31 Slightly tweaked (and improved) the CSS of the responsibilities module. 2013-07-27 13:56:38 +02:00
Adam Waldenberg 171474a501 Minor authors in the HTML responsibilities view are now collapsed.
This works in the same manner as the other filtering available in the HTML
view. The minor authors of the responsibilities view equal the minor
authors of the blame view.
2013-07-26 03:18:00 +02:00
Adam Waldenberg 67418fa25d Changed the way e-mail addresses are collected when analyzing the git log.
Previously, an email for a specific author was collected whenever some
insertions/deletions were detected in an active or valid extension. This
was introduced with the addition of gravatars.

This had the side-effect that if #author1 committed some rows to a file
with an inactive or non-valid extension and #author2 later moved some of
those rows into an active or valid extension, those rows could still
belong to #author1. Consequently, when associating the author name with
an email in the blame phase, there would not be any stored email for
#author1 and no email would be associated with that author or those blamed
lines.

Emails are now (instead) always stored and associated with an author
regardless of the work or files analyzed.
2013-07-25 23:36:50 +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
Adam Waldenberg 772cef01d4 Added support for gravatars to the responsibilities module.
In the process, also took the opportunity to improve the HTML output a bit.
2013-07-25 14:32:57 +02:00
Adam Waldenberg e200fa42f9 Added some missing spaces to the Chinese translation.
There was a mistake at the top of the translation to the help text.
2013-07-25 11:37:02 +02:00
Adam Waldenberg 6b4de5d676 Updated the locales to work with the previously updated error string. 2013-07-25 09:21:23 +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 3ed1cf3618 Added the ability to specify size when fetching a gravatar URL. 2013-07-24 08:26:40 +02:00
Adam Waldenberg 329bb45947 Removed a dangling space character in the Chinese translation. 2013-07-23 01:19:37 +02:00
Adam Waldenberg c69bd515c2 Did some minor tweaks to the strings inside the terminal module. 2013-07-23 01:09:20 +02:00
Adam Waldenberg 9b5e82bc2c Terminal can now fall back to default size under Windows (Fixes issue 12).
Previously; the __get_size_windows__() function could return "None",
whenever the terminal size couldn't be determined; something which broke
the execution.

There was some chance for misbehavior under Linux as well.
2013-07-23 01:08:53 +02:00
Adam Waldenberg c5aba56928 HTMLEmbedded output was broken in the changes module. 2013-07-22 15:32:26 +02:00
Adam Waldenberg d513ba530d HTMLEmbedded output was broken in the blame module. 2013-07-22 15:30:10 +02:00
Adam Waldenberg 863d5edce4 Fixed some minor annoyances in the Swedish .po file. 2013-07-22 06:38:18 +02:00
Bill Wang 13cb15f952 Added Chinese translation (Fixes issue 11). 2013-07-22 06:22:35 +02:00
Adam Waldenberg 8e22f0d2ca Fixed broken text output in the changes module. 2013-07-22 05:57:04 +02:00
Adam Waldenberg 662cd3fa63 Fixed some behavior that got broken with the implementation of gravatars.
Previously, gitinspector always tried to merge authors with the same name
(independently of the email). This behavior tends to (for the most part)
help in projects missing a .mailmap file. Often; authors commit under the
same name, but with different emails on different computers (if they for
example have a work email on their office desktop).

Whenever different e-mail addresses are used by an author; gitinspector
will use the last email it finds and will generate a gravatar from that
email address. This behavior was chosen because authors mostly do not tend
to create a gravatar image for their old email accounts (but often have
one in their newer ones).
2013-07-22 05:51:56 +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 d07da3dc69 Bumped the version number to 0.3.0. 2013-07-15 05:33:23 +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 1e43e47f4d Updated (and generated) locale files. 2013-07-15 03:22:07 +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 291761e6a4 Exceptions now store messages in self.msg directly.
Previously, they had a msg() method for fetching the error string. This
has now been removed in favor of the directly callable attribute.
2013-07-14 04:57:32 +02:00
Adam Waldenberg cf63af8819 Fixed some pylint violations in some newly added code. 2013-07-14 04:47:34 +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 4fbcb48127 Rewrote git-config support once again.
It was still presuming that we were using optparse.
2013-07-14 04:15:10 +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 84bb7bed2d Removed a pylint violation in the localization module. 2013-07-10 16:45:46 +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 9e39bf8ed2 Added the new localization strings to the pot file.
In the process, the new strings were also translated to Swedish. To
properly handle localized string constants, a new function "N_()" was
added which can be supplied to xgettext when collecting strings.
2013-07-10 13:55:23 +02:00
Adam Waldenberg ccd995a02b Improved localization in the optval module. 2013-07-10 05:25:57 +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
Adam Waldenberg 0d2bf9b0a8 Implemented optional boolean arguments to some command-line options.
Just like in many GNU tools, it is now possible to pass an optional
boolean to some of the flags of gitinspector in the form;

--flag[=BOOL]

This gives us the ability to override options set via git-config.
For example; say we did the following:

git-config --global inspector.timeline true

We could then override this setting when running gitinspector by supplying:

./gitinspector.py --timeline=false

Implementing this was not a trivial task, as no command-line parser in
Python supports this by default (getopt, optparse, argparse). In order to
properly handle optional boolean arguments; some clever patching had to
be done to the command-line in combination with a callback function that
can handle boolean strings. To maintain compatibility with Python 2.6,
this was implemented using optparse (instead of argparse).
2013-07-09 12:40:59 +02:00
Adam Waldenberg 663493fd41 Localization module is now initialized only once (instead of twice).
This removes an unnecessary initialization and also fixes the behavior
under Windows which was broken because of the second initialization.
2013-07-04 10:55:54 +02:00
Adam Waldenberg 942836cc1c There was a mixup in the metrics module (wrong ordering of return values). 2013-07-04 10:07:41 +02:00
Adam Waldenberg bb72cc8f02 Added a handle_comment_block() function in the comment module.
This function moves most of the logic of handling comments into the
comment module itself, thus avoiding duplicated code and allowing for
a cleaner solution.
2013-07-02 23:03:09 +02:00
Adam Waldenberg f20b826d2d Added long option (--weeks) to the -w option.
This makes it clearer that it is supported in conjunction with git-config
as well.
2013-07-02 07:45:56 +02:00
Adam Waldenberg 017f63e98a The translation files are now found regardless of the current directory.
It was previously only working if gitinspector was executed from the base
directory.
2013-07-02 07:33:46 +02:00
Adam Waldenberg f9808c609b Import of localization module failed when running setup.py under Python 3. 2013-07-01 03:17:35 +02:00
Adam Waldenberg 021c1e479e git-config settings were not being fetched when a git directory was set.
It was only working if gitinspector was invoked inside a git directory.
2013-07-01 01:38:19 +02:00
Adam Waldenberg ce98a2ed70 Fixed a syntax error in the config module. 2013-07-01 00:34:28 +02:00
Adam Waldenberg ac5e38c8f0 The handling of output format was wrong in the config module. 2013-07-01 00:33:58 +02:00