mirror of
https://github.com/ejwa/gitinspector.git
synced 2025-03-26 02:01:27 +01:00
Merge d137c65b49
into b8375442a7
This commit is contained in:
commit
3c16a7e3b8
15 changed files with 102 additions and 102 deletions
|
@ -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]
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</dd><dt><span class="term">
|
||||
<span class="strong"><strong>-H, --hard</strong></span>[=BOOL]
|
||||
</span></dt><dd>
|
||||
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
|
||||
</dd><dt><span class="term">
|
||||
<span class="strong"><strong>-l, --list-file-types</strong></span>[=BOOL]
|
||||
</span></dt><dd>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -31,7 +31,7 @@ from . import comment, extensions, filtering, format, interval, terminal
|
|||
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 @@ class BlameThread(threading.Thread):
|
|||
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 @@ class BlameThread(threading.Thread):
|
|||
|
||||
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
|
||||
|
@ -118,7 +118,7 @@ class BlameThread(threading.Thread):
|
|||
|
||||
__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):
|
||||
|
@ -134,18 +134,18 @@ class Blame(object):
|
|||
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 @@ class Blame(object):
|
|||
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 @@ class Blame(object):
|
|||
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
|
||||
|
||||
|
|
|
@ -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_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__ + "\",")
|
||||
|
|
|
@ -75,7 +75,7 @@ class Runner(object):
|
|||
summed_metrics += MetricsLogic()
|
||||
|
||||
if sys.stdout.isatty() and format.is_interactive_format():
|
||||
terminal.clear_row()
|
||||
terminal.clear_line()
|
||||
else:
|
||||
os.chdir(previous_directory)
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Boolean arguments can only be given to long options.
|
|||
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
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
<script type="application/javascript">{jquery_flot_resize}</script>
|
||||
<script type="application/javascript">
|
||||
$(document).ready(function() {{
|
||||
var row = 0;
|
||||
var line = 0;
|
||||
var MINOR_AUTHOR_PERCENTAGE = 1.00;
|
||||
var isReversed = false;
|
||||
|
||||
var colorRows = function() {{
|
||||
var colorLines = function() {{
|
||||
$(this).removeClass("odd");
|
||||
|
||||
if (row++ % 2 == 1) {{
|
||||
if (line++ % 2 == 1) {{
|
||||
$(this).addClass("odd");
|
||||
}}
|
||||
|
||||
if(this == $(this).parent().find("tr:visible").get(-1)) {{
|
||||
row = 0;
|
||||
line = 0;
|
||||
}}
|
||||
}}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
|
||||
}}).parent().hide();
|
||||
|
||||
$("table.git tbody tr:visible").each(colorRows);
|
||||
$("table.git tbody tr:visible").each(colorLines);
|
||||
|
||||
$("table#changes, table#blame").tablesorter({{
|
||||
sortList: [[0,0]],
|
||||
|
@ -60,7 +60,7 @@
|
|||
0: {{ sorter: "text" }}
|
||||
}}
|
||||
}}).bind("sortEnd", function() {{
|
||||
$(this).find("tbody tr:visible").each(colorRows);
|
||||
$(this).find("tbody tr:visible").each(colorLines);
|
||||
}});
|
||||
|
||||
$("table#changes thead tr th, table#blame thead tr th").click(function() {{
|
||||
|
@ -91,20 +91,20 @@
|
|||
|
||||
if (this.clicked) {{
|
||||
this.innerHTML = "{hide_minor_authors} (" + this.hiddenCount + ") ∧";
|
||||
$(this).parent().parent().parent().find("tbody tr").show().each(colorRows);
|
||||
$(this).parent().parent().parent().find("tbody tr").show().each(colorLines);
|
||||
}} else {{
|
||||
this.innerHTML = "{show_minor_authors} (" + this.hiddenCount + ") ∨";
|
||||
$(this).parent().parent().parent().find("tbody tr td:last-child").filter(function() {{
|
||||
return parseFloat(this.innerHTML) < MINOR_AUTHOR_PERCENTAGE;
|
||||
}}).parent().hide();
|
||||
$("table.git tbody tr:visible").each(colorRows);
|
||||
$("table.git tbody tr:visible").each(colorLines);
|
||||
}}
|
||||
}});
|
||||
|
||||
filterResponsibilities();
|
||||
var hiddenResponsibilitiesCount = $("div#responsibilities div h3:hidden").length;
|
||||
if (hiddenResponsibilitiesCount > 0) {{
|
||||
$("div#responsibilities div h3:visible").each(colorRows);
|
||||
$("div#responsibilities div h3:visible").each(colorLines);
|
||||
$("div#responsibilities").prepend("<div class=\"button\">{show_minor_authors} (" + hiddenResponsibilitiesCount + ") ∨</div>");
|
||||
|
||||
$("div#responsibilities div.button").click(function() {{
|
||||
|
@ -123,18 +123,18 @@
|
|||
filterTimeLine();
|
||||
var hiddenTimelineCount = $("div#timeline table.git tbody tr:hidden").length;
|
||||
if (hiddenTimelineCount > 0) {{
|
||||
$("div#timeline table.git tbody tr:visible").each(colorRows);
|
||||
$("div#timeline").prepend("<div class=\"button\">{show_minor_rows} (" + hiddenTimelineCount + ") ∨</div>");
|
||||
$("div#timeline table.git tbody tr:visible").each(colorLines);
|
||||
$("div#timeline").prepend("<div class=\"button\">{show_minor_lines} (" + hiddenTimelineCount + ") ∨</div>");
|
||||
|
||||
$("div#timeline div.button").click(function() {{
|
||||
this.clicked = !this.clicked;
|
||||
if (this.clicked) {{
|
||||
this.innerHTML = "{hide_minor_rows} (" + hiddenTimelineCount + ") ∧";
|
||||
$("div#timeline table.git tbody tr").show().each(colorRows);
|
||||
this.innerHTML = "{hide_minor_lines} (" + hiddenTimelineCount + ") ∧";
|
||||
$("div#timeline table.git tbody tr").show().each(colorLines);
|
||||
}} else {{
|
||||
this.innerHTML = "{show_minor_rows} (" + hiddenTimelineCount + ") ∨";
|
||||
this.innerHTML = "{show_minor_lines} (" + hiddenTimelineCount + ") ∨";
|
||||
filterTimeLine();
|
||||
$("div#timeline table.git tbody tr:visible").each(colorRows);
|
||||
$("div#timeline table.git tbody tr:visible").each(colorLines);
|
||||
}}
|
||||
}});
|
||||
}}
|
||||
|
|
|
@ -27,7 +27,7 @@ from .. import format, gravatar, terminal
|
|||
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,17 +43,17 @@ class BlameOutput(Outputable):
|
|||
blame_xml = "<div><div class=\"box\">"
|
||||
blame_xml += "<p>" + _(BLAME_INFO_TEXT) + ".</p><div><table id=\"blame\" class=\"git\">"
|
||||
blame_xml += "<thead><tr> <th>{0}</th> <th>{1}</th> <th>{2}</th> <th>{3}</th> <th>{4}</th> </tr></thead>".format(
|
||||
_("Author"), _("Rows"), _("Stability"), _("Age"), _("% in comments"))
|
||||
_("Author"), _("Lines"), _("Stability"), _("Age"), _("% in comments"))
|
||||
blame_xml += "<tbody>"
|
||||
chart_data = ""
|
||||
blames = sorted(self.blame.get_summed_blames().items())
|
||||
total_blames = 0
|
||||
|
||||
for i in blames:
|
||||
total_blames += i[1].rows
|
||||
total_blames += i[1].lines
|
||||
|
||||
for i, entry in enumerate(blames):
|
||||
work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
|
||||
work_percentage = str("{0:.2f}".format(100.0 * entry[1].lines / total_blames))
|
||||
blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")
|
||||
|
||||
if format.get_selected() == "html":
|
||||
|
@ -62,10 +62,10 @@ class BlameOutput(Outputable):
|
|||
else:
|
||||
blame_xml += "<td>" + entry[0] + "</td>"
|
||||
|
||||
blame_xml += "<td>" + str(entry[1].rows) + "</td>"
|
||||
blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>")
|
||||
blame_xml += "<td>" + "{0:.1f}".format(float(entry[1].skew) / entry[1].rows) + "</td>"
|
||||
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
|
||||
blame_xml += "<td>" + str(entry[1].lines) + "</td>"
|
||||
blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].lines, self.changes)) + "</td>")
|
||||
blame_xml += "<td>" + "{0:.1f}".format(float(entry[1].skew) / entry[1].lines) + "</td>"
|
||||
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].lines) + "</td>"
|
||||
blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
|
||||
blame_xml += "</tr>"
|
||||
chart_data += "{{label: {0}, data: {1}}}".format(json.dumps(entry[0]), work_percentage)
|
||||
|
@ -104,13 +104,13 @@ class BlameOutput(Outputable):
|
|||
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"
|
||||
stability_json = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
|
||||
lines_json = "\t\t\t\t\"lines\": " + str(i[1].lines) + ",\n"
|
||||
stability_json = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].lines,
|
||||
self.changes)) + ",\n")
|
||||
age_json = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + ",\n")
|
||||
age_json = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].lines) + ",\n")
|
||||
percentage_in_comments_json = ("\t\t\t\t\"percentage_in_comments\": " +
|
||||
"{0:.2f}".format(100.0 * i[1].comments / i[1].rows) + "\n")
|
||||
blame_json += ("{\n" + name_json + email_json + gravatar_json + rows_json + stability_json + age_json +
|
||||
"{0:.2f}".format(100.0 * i[1].comments / i[1].lines) + "\n")
|
||||
blame_json += ("{\n" + name_json + email_json + gravatar_json + lines_json + stability_json + age_json +
|
||||
percentage_in_comments_json + "\t\t\t},")
|
||||
else:
|
||||
blame_json = blame_json[:-1]
|
||||
|
@ -119,18 +119,18 @@ class BlameOutput(Outputable):
|
|||
|
||||
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()):
|
||||
print(terminal.ljust(i[0], 20)[0:20 - terminal.get_excess_column_count(i[0])], end=" ")
|
||||
print(str(i[1].rows).rjust(10), end=" ")
|
||||
print("{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)).rjust(14), end=" ")
|
||||
print("{0:.1f}".format(float(i[1].skew) / i[1].rows).rjust(12), end=" ")
|
||||
print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(19))
|
||||
print(str(i[1].lines).rjust(10), end=" ")
|
||||
print("{0:.1f}".format(Blame.get_stability(i[0], i[1].lines, self.changes)).rjust(14), end=" ")
|
||||
print("{0:.1f}".format(float(i[1].skew) / i[1].lines).rjust(12), end=" ")
|
||||
print("{0:.2f}".format(100.0 * i[1].comments / i[1].lines).rjust(19))
|
||||
|
||||
def output_xml(self):
|
||||
message_xml = "\t\t<message>" + _(BLAME_INFO_TEXT) + "</message>\n"
|
||||
|
@ -142,13 +142,13 @@ class BlameOutput(Outputable):
|
|||
name_xml = "\t\t\t\t<name>" + i[0] + "</name>\n"
|
||||
email_xml = "\t\t\t\t<email>" + author_email + "</email>\n"
|
||||
gravatar_xml = "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n"
|
||||
rows_xml = "\t\t\t\t<rows>" + str(i[1].rows) + "</rows>\n"
|
||||
stability_xml = ("\t\t\t\t<stability>" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
|
||||
lines_xml = "\t\t\t\t<lines>" + str(i[1].lines) + "</lines>\n"
|
||||
stability_xml = ("\t\t\t\t<stability>" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].lines,
|
||||
self.changes)) + "</stability>\n")
|
||||
age_xml = ("\t\t\t\t<age>" + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + "</age>\n")
|
||||
percentage_in_comments_xml = ("\t\t\t\t<percentage-in-comments>" + "{0:.2f}".format(100.0 * i[1].comments / i[1].rows) +
|
||||
age_xml = ("\t\t\t\t<age>" + "{0:.1f}".format(float(i[1].skew) / i[1].lines) + "</age>\n")
|
||||
percentage_in_comments_xml = ("\t\t\t\t<percentage-in-comments>" + "{0:.2f}".format(100.0 * i[1].comments / i[1].lines) +
|
||||
"</percentage-in-comments>\n")
|
||||
blame_xml += ("\t\t\t<author>\n" + name_xml + email_xml + gravatar_xml + rows_xml + stability_xml +
|
||||
blame_xml += ("\t\t\t<author>\n" + name_xml + email_xml + gravatar_xml + lines_xml + stability_xml +
|
||||
age_xml + percentage_in_comments_xml + "\t\t\t</author>\n")
|
||||
|
||||
print("\t<blame>\n" + message_xml + "\t\t<authors>\n" + blame_xml + "\t\t</authors>\n\t</blame>")
|
||||
|
|
|
@ -101,7 +101,7 @@ class ResponsibilitiesOutput(Outputable):
|
|||
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 @@ class ResponsibilitiesOutput(Outputable):
|
|||
for j, entry in enumerate(responsibilities):
|
||||
resp_xml += "\t\t\t\t\t<file>\n"
|
||||
resp_xml += "\t\t\t\t\t\t<name>" + entry[1] + "</name>\n"
|
||||
resp_xml += "\t\t\t\t\t\t<rows>" + str(entry[0]) + "</rows>\n"
|
||||
resp_xml += "\t\t\t\t\t\t<lines>" + str(entry[0]) + "</lines>\n"
|
||||
resp_xml += "\t\t\t\t\t</file>\n"
|
||||
|
||||
if j >= 9:
|
||||
|
|
|
@ -25,9 +25,9 @@ from .. import format, gravatar, terminal, timeline
|
|||
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_LINES_TEXT = N_("Modified Lines:")
|
||||
|
||||
def __output_row__text__(timeline_data, periods, names):
|
||||
def __output_line__text__(timeline_data, periods, names):
|
||||
print("\n" + terminal.__bold__ + terminal.ljust(_("Author"), 20), end=" ")
|
||||
|
||||
for period in periods:
|
||||
|
@ -47,7 +47,7 @@ def __output_row__text__(timeline_data, periods, names):
|
|||
len(signs_str) == 0 else signs_str).rjust(10), end=" ")
|
||||
print("")
|
||||
|
||||
print(terminal.__bold__ + terminal.ljust(_(MODIFIED_ROWS_TEXT), 20) + terminal.__normal__, end=" ")
|
||||
print(terminal.__bold__ + terminal.ljust(_(MODIFIED_LINES_TEXT), 20) + terminal.__normal__, end=" ")
|
||||
|
||||
for period in periods:
|
||||
total_changes = str(timeline_data.get_total_changes_in_period(period)[2])
|
||||
|
@ -59,7 +59,7 @@ def __output_row__text__(timeline_data, periods, names):
|
|||
|
||||
print("")
|
||||
|
||||
def __output_row__html__(timeline_data, periods, names):
|
||||
def __output_line__html__(timeline_data, periods, names):
|
||||
timeline_xml = "<table class=\"git full\"><thead><tr><th>" + _("Author") + "</th>"
|
||||
|
||||
for period in periods:
|
||||
|
@ -87,7 +87,7 @@ def __output_row__html__(timeline_data, periods, names):
|
|||
timeline_xml += "</tr>"
|
||||
i = i + 1
|
||||
|
||||
timeline_xml += "<tfoot><tr><td><strong>" + _(MODIFIED_ROWS_TEXT) + "</strong></td>"
|
||||
timeline_xml += "<tfoot><tr><td><strong>" + _(MODIFIED_LINES_TEXT) + "</strong></td>"
|
||||
|
||||
for period in periods:
|
||||
total_changes = timeline_data.get_total_changes_in_period(period)
|
||||
|
@ -110,24 +110,24 @@ class TimelineOutput(Outputable):
|
|||
periods = timeline_data.get_periods()
|
||||
names = timeline_data.get_authors()
|
||||
(width, _unused) = terminal.get_size()
|
||||
max_periods_per_row = int((width - 21) / 11)
|
||||
max_periods_per_line = int((width - 21) / 11)
|
||||
|
||||
for i in range(0, len(periods), max_periods_per_row):
|
||||
__output_row__text__(timeline_data, periods[i:i+max_periods_per_row], names)
|
||||
for i in range(0, len(periods), max_periods_per_line):
|
||||
__output_line__text__(timeline_data, periods[i:i+max_periods_per_line], names)
|
||||
|
||||
def output_html(self):
|
||||
if self.changes.get_commits():
|
||||
timeline_data = timeline.TimelineData(self.changes, self.useweeks)
|
||||
periods = timeline_data.get_periods()
|
||||
names = timeline_data.get_authors()
|
||||
max_periods_per_row = 8
|
||||
max_periods_per_line = 8
|
||||
|
||||
timeline_xml = "<div><div id=\"timeline\" class=\"box\">"
|
||||
timeline_xml += "<p>" + _(TIMELINE_INFO_TEXT) + ".</p>"
|
||||
print(timeline_xml)
|
||||
|
||||
for i in range(0, len(periods), max_periods_per_row):
|
||||
__output_row__html__(timeline_data, periods[i:i+max_periods_per_row], names)
|
||||
for i in range(0, len(periods), max_periods_per_line):
|
||||
__output_line__html__(timeline_data, periods[i:i+max_periods_per_line], names)
|
||||
|
||||
timeline_xml = "</div></div>"
|
||||
print(timeline_xml)
|
||||
|
@ -164,9 +164,9 @@ class TimelineOutput(Outputable):
|
|||
authors_json = authors_json[:-1]
|
||||
|
||||
authors_json += "],\n"
|
||||
modified_rows_json = "\t\t\t\t\"modified_rows\": " + \
|
||||
modified_lines_json = "\t\t\t\t\"modified_lines\": " + \
|
||||
str(timeline_data.get_total_changes_in_period(period)[2]) + "\n"
|
||||
timeline_json += "{\n" + name_json + authors_json + modified_rows_json + "\t\t\t},"
|
||||
timeline_json += "{\n" + name_json + authors_json + modified_lines_json + "\t\t\t},"
|
||||
else:
|
||||
timeline_json = timeline_json[:-1]
|
||||
|
||||
|
@ -201,8 +201,8 @@ class TimelineOutput(Outputable):
|
|||
authors_xml += "\t\t\t\t\t\t<work>" + signs_str + "</work>\n\t\t\t\t\t</author>\n"
|
||||
|
||||
authors_xml += "\t\t\t\t</authors>\n"
|
||||
modified_rows_xml = "\t\t\t\t<modified_rows>" + \
|
||||
str(timeline_data.get_total_changes_in_period(period)[2]) + "</modified_rows>\n"
|
||||
timeline_xml += "\t\t\t<period>\n" + name_xml + authors_xml + modified_rows_xml + "\t\t\t</period>\n"
|
||||
modified_lines_xml = "\t\t\t\t<modified_lines>" + \
|
||||
str(timeline_data.get_total_changes_in_period(period)[2]) + "</modified_lines>\n"
|
||||
timeline_xml += "\t\t\t<period>\n" + name_xml + authors_xml + modified_lines_xml + "\t\t\t</period>\n"
|
||||
|
||||
print("\t<timeline>\n" + message_xml + periods_xml + timeline_xml + "\t\t</periods>\n\t</timeline>")
|
||||
|
|
|
@ -30,8 +30,8 @@ class Responsibilities(object):
|
|||
|
||||
for i in blame.blames.items():
|
||||
if author_name == i[0][0]:
|
||||
total_rows = i[1].rows - i[1].comments
|
||||
if total_rows > 0:
|
||||
author_blames[i[0][1]] = total_rows
|
||||
total_lines = i[1].lines - i[1].comments
|
||||
if total_lines > 0:
|
||||
author_blames[i[0][1]] = total_lines
|
||||
|
||||
return sorted(author_blames.items())
|
||||
|
|
|
@ -76,7 +76,7 @@ def __get_size_linux__():
|
|||
|
||||
return int(size[1]), int(size[0])
|
||||
|
||||
def clear_row():
|
||||
def clear_line():
|
||||
print("\r", end="")
|
||||
|
||||
def skip_escapes(skip):
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 "
|
||||
|
|
Loading…
Add table
Reference in a new issue