diff --git a/dvc/graph/commit.py b/dvc/graph/commit.py index e008468f4..24a5a8ca2 100644 --- a/dvc/graph/commit.py +++ b/dvc/graph/commit.py @@ -61,9 +61,7 @@ class Commit(object): return comment[:Commit.TEXT_LIMIT-3] + '...' def _comments_text(self, max_commits=100): - res = [] - if not self.is_repro: - res.append(self._text_comment(self)) + res = [self._text_comment(self)] for commit in self._collapsed_commits: if not commit.is_repro: @@ -73,7 +71,7 @@ class Commit(object): was_collapsed = len(res) > max_commits res = res[:max_commits] - max_len = max(map(lambda x: len(x), res)) + max_len = max(map(lambda x: len(x), res + [""])) res_extended_len = map(lambda x: x.ljust(max_len), res) if was_collapsed: diff --git a/tests/test_workflow.py b/tests/test_workflow.py index 50ca6c453..ec55ad633 100644 --- a/tests/test_workflow.py +++ b/tests/test_workflow.py @@ -69,6 +69,10 @@ class TestWorkflow(TestCase): wf.collapse_commits(CollapseDvcReproCommitsStrategy(wf)) self.assertEqual(len(wf._commits), 2) + self.assertTrue('1' in wf._commits) + self.assertTrue('3' in wf._commits) + self.assertFalse('2' in wf._commits) + self.assertEqual(wf._commits[self._commit1.hash].text(), self._showed_text1) self.assertEqual(wf._commits[self._commit3.hash].text(), self._showed_text3) self.assertTrue('2' not in wf._commits)