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

Unified Diff: git_cl/git_cl.py

Issue 6685062: Reland again Msysgit Support for gcl and git-cl.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: rebase Created 9 years, 9 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 | « gcl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl/git_cl.py
===================================================================
--- git_cl/git_cl.py (revision 78331)
+++ git_cl/git_cl.py (working copy)
@@ -688,16 +688,22 @@
fileobj.close()
# Open up the default editor in the system to get the CL description.
- ret = subprocess.call(editor + ' ' + filename, shell=True)
- if ret != 0:
+ try:
+ cmd = '%s %s' % (editor, filename)
+ if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
+ # Msysgit requires the usage of 'env' to be present.
+ cmd = 'env ' + cmd
+ # shell=True to allow the shell to handle all forms of quotes in $EDITOR.
+ subprocess.check_call(cmd, shell=True)
+ fileobj = open(filename)
+ text = fileobj.read()
+ fileobj.close()
+ finally:
os.remove(filename)
+
+ if not text:
return
- fileobj = open(filename)
- text = fileobj.read()
- fileobj.close()
- os.remove(filename)
-
stripcomment_re = re.compile(r'^#.*$', re.MULTILINE)
return stripcomment_re.sub('', text).strip()
« no previous file with comments | « gcl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698