← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-diffstat into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-diffstat into launchpad:master.

Commit message:
Fix Diff.generateDiffstat for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394482

patch.newname is bytes, so we need to decode it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-diffstat into launchpad:master.
diff --git a/lib/lp/code/model/diff.py b/lib/lp/code/model/diff.py
index 909ec8b..cd973c3 100644
--- a/lib/lp/code/model/diff.py
+++ b/lib/lp/code/model/diff.py
@@ -282,7 +282,7 @@ class Diff(SQLBase):
         for patch in patches:
             if not isinstance(patch, Patch):
                 continue
-            path = patch.newname.split('\t')[0]
+            path = patch.newname.decode('UTF-8', 'replace').split('\t')[0]
             if strip_prefix_segments:
                 path = path.split('/', strip_prefix_segments)[-1]
             file_stats[path] = tuple(patch.stats_values()[:2])