Enable operating on patches with unicode chars in subject lines

Currently, when run on a repository with commits containing
unicode characters in their subject lines, an exception is
generated when these patch descriptions are written to the
todo file. This patch fixes that issue by writing the todo
file using UTF-8 encoding

Change-Id: I7ed61d5432cde842b09ec106011e584dd0d5a3d0
This commit is contained in:
Jonathan Brownell
2014-09-29 10:40:06 -07:00
parent 8ff1af4bd9
commit 5a415fd453
2 changed files with 4 additions and 2 deletions

View File

@@ -40,7 +40,8 @@ index 170ec46..251e1dd 100644
keywords="git hpcloud workflow",
EOP
git commit -a -m "Add maintainer info" --quiet || return 1
# use smart quotes to test unicode characters in commit messages
git commit -a -m "Add “Davide Guerri” as maintainer" --quiet || return 1
git push -u origin master --quiet >/dev/null || return 1
log DEBUG "Cherry picking upstream commits"

View File

@@ -20,6 +20,7 @@ from git_upstream.log import LogDedentMixin
from subprocess import call
import os
import codecs
REBASE_EDITOR_SCRIPT = "rebase-editor"
@@ -78,7 +79,7 @@ class RebaseEditor(GitMixin, LogDedentMixin):
break
root = None
with open(todo_file, "w") as todo:
with codecs.open(todo_file, "w", "utf-8") as todo:
for commit in commits:
if not root:
root = commit.parents[0].hexsha