Simplify Commit._comments_text()

This commit is contained in:
Dmitry
2017-09-18 05:11:38 -07:00
parent bb9de4b691
commit 3744cec95d
+4 -6
View File
@@ -38,7 +38,7 @@ class Commit(object):
self._collapsed_commits.append(commit)
self._collapsed_commits += commit._collapsed_commits
def text(self, max_commits=None):
def text(self, max_commits=100):
branch_text = ''
if self._branch_tips:
branch_text = 'BRANCH TIPS: {}\n'.format(', '.join(self._branch_tips))
@@ -60,7 +60,7 @@ class Commit(object):
else:
return comment[:Commit.TEXT_LIMIT-3] + '...'
def _comments_text(self, max_commits):
def _comments_text(self, max_commits=100):
res = []
if not self.is_repro:
res.append(self._text_comment(self))
@@ -72,10 +72,8 @@ class Commit(object):
if len(res) == 0:
return self._text_comment(self)
was_collapsed = False
if max_commits:
was_collapsed = len(res) > max_commits
res = res[:max_commits]
was_collapsed = len(res) > max_commits
res = res[:max_commits]
max_len = max(map(lambda x: len(x), res))
res_extended_len = map(lambda x: x.ljust(max_len), res)