mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-07 23:09:21 +01:00
Simplify Commit._comments_text()
This commit is contained in:
+4
-6
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user