From 8ce6efa0d0f07c9260f37c93162288651d37ea03 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 2 Feb 2022 05:35:28 +0900 Subject: [PATCH] Fix the #207 detection code to work better with python3 --- cinnabar/githg.py | 3 ++- cinnabar/hg/repo.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cinnabar/githg.py b/cinnabar/githg.py index 6dd94d509..b35053932 100644 --- a/cinnabar/githg.py +++ b/cinnabar/githg.py @@ -1313,7 +1313,8 @@ def tagset_lines(tags): util.iteritems(stored_files)): if not GitHgHelper.check_file(node, parent1, parent2): busted = True - logging.error("Error in file %s" % node) + logging.error( + "Error in file %s" % node.decode('ascii', 'replace')) if busted: import json extra = "" diff --git a/cinnabar/hg/repo.py b/cinnabar/hg/repo.py index d935d0a07..af22d2c7e 100644 --- a/cinnabar/hg/repo.py +++ b/cinnabar/hg/repo.py @@ -510,9 +510,11 @@ def getbundle(self, name, heads, common, *args, **kwargs): heads = [hexlify(h) for h in heads] common = [hexlify(c) for c in common] bundlecaps = b','.join(kwargs.get('bundlecaps', ())) - getbundle_params["heads"] = heads - getbundle_params["common"] = common - getbundle_params["bundlecaps"] = bundlecaps + getbundle_params["heads"] = [ + h.decode('ascii', 'replace') for h in heads] + getbundle_params["common"] = [ + c.decode('ascii', 'replace') for c in common] + getbundle_params["bundlecaps"] = bundlecaps.decode('utf-8', 'replace') data = HgRepoHelper.getbundle(heads, common, bundlecaps) header = readexactly(data, 4) if header == b'HG20':