Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1088)

Unified Diff: checkout.py

Issue 6928037: Enforce unicode commit message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/checkout_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: checkout.py
diff --git a/checkout.py b/checkout.py
index d4db42c2ac4c8a8d9a3c1638d33df95735fe1e9e..e952b193c1889b930b06e0f5304894615ed37f9e 100644
--- a/checkout.py
+++ b/checkout.py
@@ -295,9 +295,12 @@ class SvnCheckout(CheckoutBase, SvnMixIn):
def commit(self, commit_message, user):
logging.info('Committing patch for %s' % user)
assert self.commit_user
+ assert isinstance(commit_message, unicode)
handle, commit_filename = tempfile.mkstemp(text=True)
try:
- os.write(handle, commit_message)
+ # Shouldn't assume default encoding is UTF-8. But really, if you are using
+ # anything else, you are living in another world.
+ os.write(handle, commit_message.encode('utf-8'))
os.close(handle)
# When committing, svn won't update the Revision metadata of the checkout,
# so if svn commit returns "Committed revision 3.", svn info will still
@@ -427,6 +430,7 @@ class GitCheckoutBase(CheckoutBase):
Subclass needs to dcommit or push.
"""
+ assert isinstance(commit_message, unicode)
self._check_call_git(['commit', '--amend', '-m', commit_message])
return self._check_output_git(['rev-parse', 'HEAD']).strip()
« no previous file with comments | « no previous file | tests/checkout_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698