From c387ec309f63573b4dab617c95cf1930724c2d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 20 Jun 2020 13:01:45 +0000 Subject: [PATCH 1/3] Depend on Dulwich < 0.20 on Python < 3. Dulwich 0.20.0 dropped support for Python 2 and 3.4. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c416d4ae..64949686 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def install_data_files_hack(): install_data_files_hack() -requires = ['six', 'flask', 'Werkzeug>=0.15.0', 'pygments', 'dulwich>=0.19.3', 'httpauth', 'humanize'] +requires = ['six', 'flask', 'Werkzeug>=0.15.0', 'pygments', 'httpauth', 'humanize', 'dulwich>=0.19.3;python_version>="3.5"', 'dulwich>=0.19.3,<0.20;python_version<"3.5"'] setup( name='klaus', From 85063c931ced4f97adecabcec065d907a7106efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 20 Jun 2020 13:30:30 +0000 Subject: [PATCH 2/3] Properly escape backslash, fixes warning on Python >= 3.5. --- tests/test_manpage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_manpage.py b/tests/test_manpage.py index fce93fc3..94002477 100644 --- a/tests/test_manpage.py +++ b/tests/test_manpage.py @@ -13,7 +13,7 @@ def test_covers_all_cli_options(): manpage = force_unicode(subprocess.check_output(["man", "./klaus.1"])) def assert_in_manpage(s): - clean = lambda x: re.sub('(.\\x08)|\s', '', x) + clean = lambda x: re.sub('(.\\x08)|\\s', '', x) assert clean(s) in clean(manpage), "%r not found in manpage" % s mock_parser = mock.Mock() From 496c2b68294692bb298ab2c537bf35875c8ba442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelmer=20Vernoo=C4=B3?= Date: Sat, 20 Jun 2020 13:33:33 +0000 Subject: [PATCH 3/3] Fix encoding for ref name on Python 3. --- klaus/repo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/klaus/repo.py b/klaus/repo.py index c506c207..8707aa7f 100644 --- a/klaus/repo.py +++ b/klaus/repo.py @@ -142,8 +142,8 @@ def get_tag_names(self): def get_tag_and_branch_shas(self): """Return a list of SHAs of all tags and branches.""" - tag_shas = self.get_refs_as_dict('refs/tags/').values() - branch_shas = self.get_refs_as_dict('refs/heads/').values() + tag_shas = self.get_refs_as_dict(b'refs/tags/').values() + branch_shas = self.get_refs_as_dict(b'refs/heads/').values() return set(tag_shas) | set(branch_shas) def history(self, commit, path=None, max_commits=None, skip=0):