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

Side by Side Diff: trychange.py

Issue 10815009: gclient_utils.FileWrite() assumes text data but trychange doesn't. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn repository or by directly connecting 7 the try server by either writting to a svn repository or by directly connecting
8 to the server by HTTP. 8 to the server by HTTP.
9 """ 9 """
10 10
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 try: 392 try:
393 # Description 393 # Description
394 temp_file.write(description) 394 temp_file.write(description)
395 temp_file.flush() 395 temp_file.flush()
396 396
397 # Diff file 397 # Diff file
398 current_time = str(datetime.datetime.now()).replace(':', '.') 398 current_time = str(datetime.datetime.now()).replace(':', '.')
399 file_name = (Escape(options.user) + '.' + Escape(options.name) + 399 file_name = (Escape(options.user) + '.' + Escape(options.name) +
400 '.%s.diff' % current_time) 400 '.%s.diff' % current_time)
401 full_path = os.path.join(temp_dir, file_name) 401 full_path = os.path.join(temp_dir, file_name)
402 gclient_utils.FileWrite(full_path, options.diff, 'wb') 402 with open(full_path, 'wb') as f:
403 f.write(options.diff)
403 404
404 # Committing it will trigger a try job. 405 # Committing it will trigger a try job.
405 if sys.platform == "cygwin": 406 if sys.platform == "cygwin":
406 # Small chromium-specific issue here: 407 # Small chromium-specific issue here:
407 # git-try uses /usr/bin/python on cygwin but svn.bat will be used 408 # git-try uses /usr/bin/python on cygwin but svn.bat will be used
408 # instead of /usr/bin/svn by default. That causes bad things(tm) since 409 # instead of /usr/bin/svn by default. That causes bad things(tm) since
409 # Windows' svn.exe has no clue about cygwin paths. Hence force to use 410 # Windows' svn.exe has no clue about cygwin paths. Hence force to use
410 # the cygwin version in this particular context. 411 # the cygwin version in this particular context.
411 exe = "/usr/bin/svn" 412 exe = "/usr/bin/svn"
412 else: 413 else:
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 return 1 838 return 1
838 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 839 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
839 print >> sys.stderr, e 840 print >> sys.stderr, e
840 return 1 841 return 1
841 return 0 842 return 0
842 843
843 844
844 if __name__ == "__main__": 845 if __name__ == "__main__":
845 fix_encoding.fix_encoding() 846 fix_encoding.fix_encoding()
846 sys.exit(TryChange(None, None, False)) 847 sys.exit(TryChange(None, None, False))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698