From 5f95f53d93e6b317c2cbd490e5078e1d6e34540f Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 10:51:27 -0400 Subject: [PATCH 1/7] Change 'row' to 'line' in HTML output --- gitinspector/blame.py | 2 +- gitinspector/format.py | 4 ++-- gitinspector/help.py | 2 +- gitinspector/output/blameoutput.py | 4 ++-- gitinspector/output/timelineoutput.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 317d3f9d..00972f1c 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -118,7 +118,7 @@ def run(self): __thread_lock__.release() # Lock controlling the number of threads running -PROGRESS_TEXT = N_("Checking how many rows belong to each author (2 of 2): {0:.0f}%") +PROGRESS_TEXT = N_("Checking how many lines belong to each author (2 of 2): {0:.0f}%") class Blame(object): def __init__(self, repo, hard, useweeks, changes): diff --git a/gitinspector/format.py b/gitinspector/format.py index 505da033..2e9a1a4b 100644 --- a/gitinspector/format.py +++ b/gitinspector/format.py @@ -106,8 +106,8 @@ def output_header(repos): repos_string, localization.get_date()), show_minor_authors=_("Show minor authors"), hide_minor_authors=_("Hide minor authors"), - show_minor_rows=_("Show rows with minor work"), - hide_minor_rows=_("Hide rows with minor work"))) + show_minor_rows=_("Show lines with minor work"), + hide_minor_rows=_("Hide lines with minor work"))) elif __selected_format__ == "json": print("{\n\t\"gitinspector\": {") print("\t\t\"version\": \"" + version.__version__ + "\",") diff --git a/gitinspector/help.py b/gitinspector/help.py index 447dcb50..6721bc0b 100644 --- a/gitinspector/help.py +++ b/gitinspector/help.py @@ -45,7 +45,7 @@ is formatted for grading of student projects; this is the same as supplying the options -HlmrTw - -H, --hard[=BOOL] track rows and look for duplicates harder; + -H, --hard[=BOOL] track lines and look for duplicates harder; this can be quite slow with big repositories -l, --list-file-types[=BOOL] list all the file extensions available in the current branch of the repository diff --git a/gitinspector/output/blameoutput.py b/gitinspector/output/blameoutput.py index f49ee63b..bbc2ebc4 100644 --- a/gitinspector/output/blameoutput.py +++ b/gitinspector/output/blameoutput.py @@ -27,7 +27,7 @@ from ..blame import Blame from .outputable import Outputable -BLAME_INFO_TEXT = N_("Below are the number of rows from each author that have survived and are still " +BLAME_INFO_TEXT = N_("Below are the number of lines from each author that have survived and are still " "intact in the current revision") class BlameOutput(Outputable): @@ -43,7 +43,7 @@ def output_html(self): blame_xml = "
" blame_xml += "

" + _(BLAME_INFO_TEXT) + ".

" blame_xml += "".format( - _("Author"), _("Rows"), _("Stability"), _("Age"), _("% in comments")) + _("Author"), _("Lines"), _("Stability"), _("Age"), _("% in comments")) blame_xml += "" chart_data = "" blames = sorted(self.blame.get_summed_blames().items()) diff --git a/gitinspector/output/timelineoutput.py b/gitinspector/output/timelineoutput.py index f76228bf..fd1dcb25 100644 --- a/gitinspector/output/timelineoutput.py +++ b/gitinspector/output/timelineoutput.py @@ -25,7 +25,7 @@ from .outputable import Outputable TIMELINE_INFO_TEXT = N_("The following history timeline has been gathered from the repository") -MODIFIED_ROWS_TEXT = N_("Modified Rows:") +MODIFIED_ROWS_TEXT = N_("Modified Lines:") def __output_row__text__(timeline_data, periods, names): print("\n" + terminal.__bold__ + terminal.ljust(_("Author"), 20), end=" ") From dcc80ff1454b566b38a046ba8e8b2fe23868a715 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 10:53:48 -0400 Subject: [PATCH 2/7] Change 'row' to 'line' in other outputs --- gitinspector/output/blameoutput.py | 8 ++++---- gitinspector/output/responsibilitiesoutput.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gitinspector/output/blameoutput.py b/gitinspector/output/blameoutput.py index bbc2ebc4..5c385a37 100644 --- a/gitinspector/output/blameoutput.py +++ b/gitinspector/output/blameoutput.py @@ -104,7 +104,7 @@ def output_json(self): name_json = "\t\t\t\t\"name\": \"" + i[0] + "\",\n" email_json = "\t\t\t\t\"email\": \"" + author_email + "\",\n" gravatar_json = "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(author_email) + "\",\n" - rows_json = "\t\t\t\t\"rows\": " + str(i[1].rows) + ",\n" + rows_json = "\t\t\t\t\"lines\": " + str(i[1].rows) + ",\n" stability_json = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)) + ",\n") age_json = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + ",\n") @@ -119,10 +119,10 @@ def output_json(self): def output_text(self): if sys.stdout.isatty() and format.is_interactive_format(): - terminal.clear_row() + terminal.clear_line() print(textwrap.fill(_(BLAME_INFO_TEXT) + ":", width=terminal.get_size()[0]) + "\n") - terminal.printb(terminal.ljust(_("Author"), 21) + terminal.rjust(_("Rows"), 10) + terminal.rjust(_("Stability"), 15) + + terminal.printb(terminal.ljust(_("Author"), 21) + terminal.rjust(_("Lines"), 10) + terminal.rjust(_("Stability"), 15) + terminal.rjust(_("Age"), 13) + terminal.rjust(_("% in comments"), 20)) for i in sorted(self.blame.get_summed_blames().items()): @@ -142,7 +142,7 @@ def output_xml(self): name_xml = "\t\t\t\t" + i[0] + "\n" email_xml = "\t\t\t\t" + author_email + "\n" gravatar_xml = "\t\t\t\t" + gravatar.get_url(author_email) + "\n" - rows_xml = "\t\t\t\t" + str(i[1].rows) + "\n" + rows_xml = "\t\t\t\t" + str(i[1].rows) + "\n" stability_xml = ("\t\t\t\t" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)) + "\n") age_xml = ("\t\t\t\t" + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + "\n") diff --git a/gitinspector/output/responsibilitiesoutput.py b/gitinspector/output/responsibilitiesoutput.py index 903ece25..6ecb00bb 100644 --- a/gitinspector/output/responsibilitiesoutput.py +++ b/gitinspector/output/responsibilitiesoutput.py @@ -101,7 +101,7 @@ def output_json(self): for j, entry in enumerate(responsibilities): resp_json += "{\n" resp_json += "\t\t\t\t\t\"name\": \"" + entry[1] + "\",\n" - resp_json += "\t\t\t\t\t\"rows\": " + str(entry[0]) + "\n" + resp_json += "\t\t\t\t\t\"lines\": " + str(entry[0]) + "\n" resp_json += "\t\t\t\t}," if j >= 9: @@ -131,7 +131,7 @@ def output_xml(self): for j, entry in enumerate(responsibilities): resp_xml += "\t\t\t\t\t\n" resp_xml += "\t\t\t\t\t\t" + entry[1] + "\n" - resp_xml += "\t\t\t\t\t\t" + str(entry[0]) + "\n" + resp_xml += "\t\t\t\t\t\t" + str(entry[0]) + "\n" resp_xml += "\t\t\t\t\t\n" if j >= 9: From dc02340e30db2009058d7717c20cbf907a0afb61 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 11:03:23 -0400 Subject: [PATCH 3/7] Change 'row' to 'line' in documentation --- docs/gitinspector.1 | 2 +- docs/gitinspector.html | 2 +- docs/gitinspector.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/gitinspector.1 b/docs/gitinspector.1 index e268c5e1..d7a752a0 100644 --- a/docs/gitinspector.1 +++ b/docs/gitinspector.1 @@ -68,7 +68,7 @@ Show statistics and information in a way that is formatted for grading of studen .PP \fB\-H, \-\-hard\fR[=BOOL] .RS 4 -Track rows and look for duplicates harder; this can be quite slow with big repositories +Track lines and look for duplicates harder; this can be quite slow with big repositories .RE .PP \fB\-l, \-\-list\-file\-types\fR[=BOOL] diff --git a/docs/gitinspector.html b/docs/gitinspector.html index dbfa239e..ce5b9091 100644 --- a/docs/gitinspector.html +++ b/docs/gitinspector.html @@ -14,7 +14,7 @@
-H, --hard[=BOOL]
- Track rows and look for duplicates harder; this can be quite slow with big repositories + Track lines and look for duplicates harder; this can be quite slow with big repositories
-l, --list-file-types[=BOOL]
diff --git a/docs/gitinspector.txt b/docs/gitinspector.txt index 9134805f..31e53736 100644 --- a/docs/gitinspector.txt +++ b/docs/gitinspector.txt @@ -41,7 +41,7 @@ Mandatory arguments to long options are mandatory for short options too. Boolean Show statistics and information in a way that is formatted for grading of student projects; this is the same as supplying the options *-HlmrTw* *-H, --hard*[=BOOL]:: - Track rows and look for duplicates harder; this can be quite slow with big repositories + Track lines and look for duplicates harder; this can be quite slow with big repositories *-l, --list-file-types*[=BOOL]:: List all the file extensions available in the current branch of the repository From 922f3058342a01f7ed569b1d87a3c79b83a97128 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 11:04:10 -0400 Subject: [PATCH 4/7] Update POT --- gitinspector/translations/messages.pot | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gitinspector/translations/messages.pot b/gitinspector/translations/messages.pot index 33a84d72..7dbff1ec 100644 --- a/gitinspector/translations/messages.pot +++ b/gitinspector/translations/messages.pot @@ -50,11 +50,11 @@ msgstr "" msgid "Author" msgstr "" -msgid "Below are the number of rows from each author that have survived and are still intact in the current revision" +msgid "Below are the number of lines from each author that have survived and are still intact in the current revision" msgstr "" #, python-brace-format -msgid "Checking how many rows belong to each author (Progress): {0:.0f}%" +msgid "Checking how many lines belong to each author (Progress): {0:.0f}%" msgstr "" msgid "Commits" @@ -82,7 +82,7 @@ msgstr "" msgid "Hide minor authors" msgstr "" -msgid "Hide rows with minor work" +msgid "Hide lines with minor work" msgstr "" msgid "Insertions" @@ -91,7 +91,7 @@ msgstr "" msgid "Minor Authors" msgstr "" -msgid "Modified Rows:" +msgid "Modified lines:" msgstr "" msgid "No commited files with the specified extensions were found" @@ -104,13 +104,13 @@ msgstr "" msgid "Repository statistics for {0}" msgstr "" -msgid "Rows" +msgid "lines" msgstr "" msgid "Show minor authors" msgstr "" -msgid "Show rows with minor work" +msgid "Show lines with minor work" msgstr "" msgid "Stability" @@ -193,7 +193,7 @@ msgid "" " is formatted for grading of student\n" " projects; this is the same as supplying the\n" " options -HlmrTw\n" -" -H, --hard[=BOOL] track rows and look for duplicates harder;\n" +" -H, --hard[=BOOL] track lines and look for duplicates harder;\n" " this can be quite slow with big repositories\n" " -l, --list-file-types[=BOOL] list all the file extensions available in the\n" " current branch of the repository\n" From d035f25f974d075a4103f2d0ba660c814280db5d Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 11:05:51 -0400 Subject: [PATCH 5/7] Update French PO (uses word for 'line' already) --- gitinspector/translations/messages_fr.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gitinspector/translations/messages_fr.po b/gitinspector/translations/messages_fr.po index a012c05f..8c45e9e7 100644 --- a/gitinspector/translations/messages_fr.po +++ b/gitinspector/translations/messages_fr.po @@ -49,14 +49,14 @@ msgid "Author" msgstr "Auteur" msgid "" -"Below are the number of rows from each author that have survived and are " +"Below are the number of lines from each author that have survived and are " "still intact in the current revision" msgstr "" "Le nombre de lignes par auteur encore présentes et intactes dans la version " "courante est reporté ci-dessous" #, python-brace-format -msgid "Checking how many rows belong to each author (Progress): {0:.0f}%" +msgid "Checking how many lines belong to each author (Progress): {0:.0f}%" msgstr "" "Contrôle du nombre de lignes appartenant à chaque auteur (En progrès) : " "{0:.0f}%" @@ -95,7 +95,7 @@ msgstr "Sortie HTML pas encore prise en charge pour" msgid "Hide minor authors" msgstr "Masquer les auteurs mineurs" -msgid "Hide rows with minor work" +msgid "Hide lines with minor work" msgstr "Masquer les lignes avec le moins de travail" msgid "Insertions" @@ -104,7 +104,7 @@ msgstr "Insertions" msgid "Minor Authors" msgstr "Auteurs mineurs" -msgid "Modified Rows:" +msgid "Modified Lines:" msgstr "Lignes modifiées:" msgid "No commited files with the specified extensions were found" @@ -117,13 +117,13 @@ msgstr "Aucune violation des métriques n'a été constatée dans le dépôt" msgid "Repository statistics for {0}" msgstr "Statistiques du dépôt {0}" -msgid "Rows" +msgid "Lines" msgstr "Lignes" msgid "Show minor authors" msgstr "Montrer les auteurs mineurs" -msgid "Show rows with minor work" +msgid "Show lines with minor work" msgstr "Montrer les lignes avec le moins de travail" msgid "Stability" @@ -248,7 +248,7 @@ msgid "" " projects; this is the same as supplying " "the\n" " options -HlmrTw\n" -" -H, --hard[=BOOL] track rows and look for duplicates harder;\n" +" -H, --hard[=BOOL] track lines and look for duplicates harder;\n" " this can be quite slow with big " "repositories\n" " -l, --list-file-types[=BOOL] list all the file extensions available in " From 902952b0725388c06f0a179be32e60c50e9e09d2 Mon Sep 17 00:00:00 2001 From: Remi Rampin Date: Wed, 1 Jun 2016 10:56:39 -0400 Subject: [PATCH 6/7] Replace 'row' with 'line' in whole code --- gitinspector/blame.py | 38 ++++++++++++------------- gitinspector/format.py | 4 +-- gitinspector/gitinspector.py | 2 +- gitinspector/html/html.header | 6 ++-- gitinspector/output/blameoutput.py | 40 +++++++++++++-------------- gitinspector/output/timelineoutput.py | 32 ++++++++++----------- gitinspector/responsibilities.py | 6 ++-- gitinspector/terminal.py | 2 +- 8 files changed, 65 insertions(+), 65 deletions(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index 00972f1c..0b48364e 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -31,7 +31,7 @@ NUM_THREADS = multiprocessing.cpu_count() class BlameEntry(object): - rows = 0 + lines = 0 skew = 0 # Used when calculating average code age. comments = 0 @@ -82,7 +82,7 @@ def __handle_blamechunk_content__(self, content): self.blames[(author, self.filename)] = BlameEntry() self.blames[(author, self.filename)].comments += comments - self.blames[(author, self.filename)].rows += 1 + self.blames[(author, self.filename)].lines += 1 if (self.blamechunk_time - self.changes.first_commit_date).days > 0: self.blames[(author, self.filename)].skew += ((self.changes.last_commit_date - self.blamechunk_time).days / @@ -92,18 +92,18 @@ def __handle_blamechunk_content__(self, content): def run(self): git_blame_r = subprocess.Popen(self.blame_command, bufsize=1, stdout=subprocess.PIPE).stdout - rows = git_blame_r.readlines() + lines = git_blame_r.readlines() git_blame_r.close() self.__clear_blamechunk_info__() #pylint: disable=W0201 - for j in range(0, len(rows)): - row = rows[j].decode("utf-8", "replace").strip() - keyval = row.split(" ", 2) + for j in range(0, len(lines)): + line = lines[j].decode("utf-8", "replace").strip() + keyval = line.split(" ", 2) if self.blamechunk_is_last: - self.__handle_blamechunk_content__(row) + self.__handle_blamechunk_content__(line) self.__clear_blamechunk_info__() elif keyval[0] == "boundary": self.blamechunk_is_prior = True @@ -134,18 +134,18 @@ def __init__(self, repo, hard, useweeks, changes): if repo != None: progress_text = "[%s] " % repo.name + progress_text - for i, row in enumerate(lines): - row = row.strip().decode("unicode_escape", "ignore") - row = row.encode("latin-1", "replace") - row = row.decode("utf-8", "replace").strip("\"").strip("'").strip() + for i, line in enumerate(lines): + line = line.strip().decode("unicode_escape", "ignore") + line = line.encode("latin-1", "replace") + line = line.decode("utf-8", "replace").strip("\"").strip("'").strip() - if FileDiff.get_extension(row) in extensions.get_located() and \ - FileDiff.is_valid_extension(row) and not filtering.set_filtered(FileDiff.get_filename(row)): + if FileDiff.get_extension(line) in extensions.get_located() and \ + FileDiff.is_valid_extension(line) and not filtering.set_filtered(FileDiff.get_filename(line)): blame_command = filter(None, ["git", "blame", "--line-porcelain", "-w"] + \ (["-C", "-C", "-M"] if hard else []) + - [interval.get_since(), interval.get_ref(), "--", row]) - thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), - self.blames, row.strip()) + [interval.get_since(), interval.get_ref(), "--", line]) + thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(line), + self.blames, line.strip()) thread.daemon = True thread.start() @@ -177,10 +177,10 @@ def is_revision(string): return revision.group(1).strip() @staticmethod - def get_stability(author, blamed_rows, changes): + def get_stability(author, blamed_lines, changes): if author in changes.get_authorinfo_list(): author_insertions = changes.get_authorinfo_list()[author].insertions - return 100 if author_insertions == 0 else 100.0 * blamed_rows / author_insertions + return 100 if author_insertions == 0 else 100.0 * blamed_lines / author_insertions return 100 @staticmethod @@ -194,7 +194,7 @@ def get_summed_blames(self): if summed_blames.get(i[0][0], None) == None: summed_blames[i[0][0]] = BlameEntry() - summed_blames[i[0][0]].rows += i[1].rows + summed_blames[i[0][0]].lines += i[1].lines summed_blames[i[0][0]].skew += i[1].skew summed_blames[i[0][0]].comments += i[1].comments diff --git a/gitinspector/format.py b/gitinspector/format.py index 2e9a1a4b..05ee1c62 100644 --- a/gitinspector/format.py +++ b/gitinspector/format.py @@ -106,8 +106,8 @@ def output_header(repos): repos_string, localization.get_date()), show_minor_authors=_("Show minor authors"), hide_minor_authors=_("Hide minor authors"), - show_minor_rows=_("Show lines with minor work"), - hide_minor_rows=_("Hide lines with minor work"))) + show_minor_lines=_("Show lines with minor work"), + hide_minor_lines=_("Hide lines with minor work"))) elif __selected_format__ == "json": print("{\n\t\"gitinspector\": {") print("\t\t\"version\": \"" + version.__version__ + "\",") diff --git a/gitinspector/gitinspector.py b/gitinspector/gitinspector.py index 71492943..279e4cae 100644 --- a/gitinspector/gitinspector.py +++ b/gitinspector/gitinspector.py @@ -75,7 +75,7 @@ def process(self, repos): summed_metrics += MetricsLogic() if sys.stdout.isatty() and format.is_interactive_format(): - terminal.clear_row() + terminal.clear_line() else: os.chdir(previous_directory) diff --git a/gitinspector/html/html.header b/gitinspector/html/html.header index 8cba24f6..b6e6bb97 100644 --- a/gitinspector/html/html.header +++ b/gitinspector/html/html.header @@ -10,19 +10,19 @@
{0} {1} {2} {3} {4}