Dulwich.io dulwich / d95f47c
Fix get_summary on python3. Jelmer Vernooń≥ 27 days ago
2 changed file(s) with 14 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
8282 :param commit: Commit
8383 :return: Summary string
8484 """
85 return commit.message.splitlines()[0].replace(" ", "-")
85 return commit.message.decode(errors='replace').splitlines()[0].replace(" ", "-")
8686
8787
8888 # Unified Diff
3131 MemoryObjectStore,
3232 )
3333 from dulwich.patch import (
34 get_summary,
3435 git_am_patch_split,
3536 write_blob_diff,
3637 write_commit_patch,
536537 b'-same',
537538 b'+Submodule commit 06d0bdd9e2e20377b3180e4986b14c8549b393e4',
538539 ], f.getvalue().splitlines())
540
541
542 class GetSummaryTests(TestCase):
543
544 def test_simple(self):
545 c = Commit()
546 c.committer = c.author = b"Jelmer <jelmer@samba.org>"
547 c.commit_time = c.author_time = 1271350201
548 c.commit_timezone = c.author_timezone = 0
549 c.message = b"This is the first line\nAnd this is the second line.\n"
550 c.tree = Tree().id
551 self.assertEqual('This-is-the-first-line', get_summary(c))