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

Unified Diff: git_cl.py

Issue 1590473002: Fix git cl upload --squash (for Gerrit). (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index ff83f10edc5f785ca98ebdd6d42c99c1f14fb7fd..c72d391d77354f1a24e79d56965a8bd468a1d563 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -2029,12 +2029,21 @@ def GerritUpload(options, args, cl, change):
'commit-msg')
file_handle, msg_file = tempfile.mkstemp(text=True,
prefix='commit_msg')
+ logging.debug("%s %s", file_handle, msg_file)
try:
try:
- with os.fdopen(file_handle, 'w') as fileobj:
+ try:
+ fileobj = os.fdopen(file_handle, 'w')
+ except OSError:
+ # if fdopen fails, file_handle remains open.
+ # See https://docs.python.org/2/library/os.html#os.fdopen.
+ os.close(file_handle)
+ raise
+ with fileobj:
+ # This will close the file_handle.
fileobj.write(change_desc.description)
+ logging.debug("%s %s finish editing", file_handle, msg_file)
finally:
- os.close(file_handle)
RunCommand([commit_msg_hook, msg_file])
change_desc.set_description(gclient_utils.FileRead(msg_file))
finally:
« 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