← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-iter-file-patch into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-iter-file-patch into launchpad:master.

Commit message:
iter_file_patch: Fix git patch case for Python 3

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

On Python 3, indexing a bytes object returns an int, and we need to take a one-element slice if we want a bytes object.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-iter-file-patch into launchpad:master.
diff --git a/lib/lp/code/mail/patches.py b/lib/lp/code/mail/patches.py
index 11e655d..51cf325 100644
--- a/lib/lp/code/mail/patches.py
+++ b/lib/lp/code/mail/patches.py
@@ -67,7 +67,7 @@ def iter_file_patch(iter_lines, allow_dirty=False, keep_dirty=False):
                 in_git_patch = True
             dirty_head.append(line)
             continue
-        if in_git_patch and line and line[0].islower():
+        if in_git_patch and line and line[:1].islower():
             # Extended header line in a git diff.  All extended header lines
             # currently start with a lower-case character, and nothing else
             # in the patch before the next "diff" header line can do so.