mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-16 00:28:25 +01:00
Empty rows are now skipped in the timeline output.
In practice, this means that whenever an author is not part of a collection of periods he will not be printed out. This cleans up the output and also speeds up analysis.
This commit is contained in:
parent
2dd4c2c4ff
commit
0c6358324d
1 changed files with 28 additions and 18 deletions
46
timeline.py
46
timeline.py
|
@ -95,6 +95,12 @@ class TimelineData:
|
|||
def is_author_in_period(self, period, author):
|
||||
return self.entries.get((author, period), None) != None
|
||||
|
||||
def is_author_in_periods(self, periods, author):
|
||||
for period in periods:
|
||||
if self.is_author_in_period(period, author):
|
||||
return True
|
||||
return False
|
||||
|
||||
__timeline_info_text__ = "The following history timeline has been gathered from the repository"
|
||||
|
||||
def __output_row__text__(timeline_data, periods, names):
|
||||
|
@ -106,14 +112,15 @@ def __output_row__text__(timeline_data, periods, names):
|
|||
print(terminal.__normal__)
|
||||
|
||||
for name in names:
|
||||
print(name.ljust(20)[0:20], end=" ")
|
||||
for period in periods:
|
||||
multiplier = timeline_data.get_multiplier(period, 9)
|
||||
signs = timeline_data.get_author_signs_in_period(name, period, multiplier)
|
||||
signs_str = (signs[1] * "-" + signs[0] * "+")
|
||||
print (("." if timeline_data.is_author_in_period(period, name) and
|
||||
len(signs_str) == 0 else signs_str).rjust(10), end=" ")
|
||||
print("")
|
||||
if timeline_data.is_author_in_periods(periods, name):
|
||||
print(name.ljust(20)[0:20], end=" ")
|
||||
for period in periods:
|
||||
multiplier = timeline_data.get_multiplier(period, 9)
|
||||
signs = timeline_data.get_author_signs_in_period(name, period, multiplier)
|
||||
signs_str = (signs[1] * "-" + signs[0] * "+")
|
||||
print (("." if timeline_data.is_author_in_period(period, name) and
|
||||
len(signs_str) == 0 else signs_str).rjust(10), end=" ")
|
||||
print("")
|
||||
|
||||
print(terminal.__bold__ + "Modified Rows:".ljust(20) + terminal.__normal__, end=" ")
|
||||
|
||||
|
@ -130,18 +137,21 @@ def __output_row__html__(timeline_data, periods, names):
|
|||
timeline_xml += "<th>" + str(period) + "</th>"
|
||||
|
||||
timeline_xml += "</tr></thead><tbody>"
|
||||
i = 0
|
||||
|
||||
for i, name in enumerate(names):
|
||||
timeline_xml += "<tr" + (" class=\"odd\">" if i % 2 == 1 else ">")
|
||||
timeline_xml += "<td>" + name + "</td>"
|
||||
for period in periods:
|
||||
multiplier = timeline_data.get_multiplier(period, 14)
|
||||
signs = timeline_data.get_author_signs_in_period(name, period, multiplier)
|
||||
signs_str = (signs[1] * "<div class=\"remove\"> </div>" + signs[0] * "<div class=\"insert\"> </div>")
|
||||
for name in names:
|
||||
if timeline_data.is_author_in_periods(periods, name):
|
||||
timeline_xml += "<tr" + (" class=\"odd\">" if i % 2 == 1 else ">")
|
||||
timeline_xml += "<td>" + name + "</td>"
|
||||
for period in periods:
|
||||
multiplier = timeline_data.get_multiplier(period, 14)
|
||||
signs = timeline_data.get_author_signs_in_period(name, period, multiplier)
|
||||
signs_str = (signs[1] * "<div class=\"remove\"> </div>" + signs[0] * "<div class=\"insert\"> </div>")
|
||||
|
||||
timeline_xml += "<td>" + ("." if timeline_data.is_author_in_period(period, name) and len(signs_str) == 0 else signs_str)
|
||||
timeline_xml += "</td>"
|
||||
timeline_xml += "</tr>"
|
||||
timeline_xml += "<td>" + ("." if timeline_data.is_author_in_period(period, name) and len(signs_str) == 0 else signs_str)
|
||||
timeline_xml += "</td>"
|
||||
timeline_xml += "</tr>"
|
||||
i = i + 1
|
||||
|
||||
timeline_xml += "<tfoot><tr><td><strong>Modified Rows:</strong></td>"
|
||||
|
||||
|
|
Loading…
Reference in a new issue