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

Side by Side Diff: gcl.py

Issue 6985002: Make gcl and git-cl don't throw when a vim user does :cg (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 7 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 | git_cl.py » ('j') | 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) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 """\ 6 """\
7 Wrapper script around Rietveld's upload.py that simplifies working with groups 7 Wrapper script around Rietveld's upload.py that simplifies working with groups
8 of files. 8 of files.
9 """ 9 """
10 10
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 os.write(handle, text) 1112 os.write(handle, text)
1113 os.close(handle) 1113 os.close(handle)
1114 1114
1115 # Open up the default editor in the system to get the CL description. 1115 # Open up the default editor in the system to get the CL description.
1116 try: 1116 try:
1117 if not silent: 1117 if not silent:
1118 cmd = '%s %s' % (GetEditor(), filename) 1118 cmd = '%s %s' % (GetEditor(), filename)
1119 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': 1119 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
1120 # Msysgit requires the usage of 'env' to be present. 1120 # Msysgit requires the usage of 'env' to be present.
1121 cmd = 'env ' + cmd 1121 cmd = 'env ' + cmd
1122 # shell=True to allow the shell to handle all forms of quotes in $EDITOR. 1122 try:
1123 subprocess.check_call(cmd, shell=True) 1123 # shell=True to allow the shell to handle all forms of quotes in
1124 # $EDITOR.
1125 subprocess.check_call(cmd, shell=True)
1126 except subprocess.CalledProcessError, e:
1127 ErrorExit('Editor returned %d' % e.returncode)
1124 result = gclient_utils.FileRead(filename, 'r') 1128 result = gclient_utils.FileRead(filename, 'r')
1125 finally: 1129 finally:
1126 os.remove(filename) 1130 os.remove(filename)
1127 1131
1128 if not result: 1132 if not result:
1129 return 0 1133 return 0
1130 1134
1131 split_result = result.split(separator1, 1) 1135 split_result = result.split(separator1, 1)
1132 if len(split_result) != 2: 1136 if len(split_result) != 2:
1133 ErrorExit("Don't modify the text starting with ---!\n\n" + result) 1137 ErrorExit("Don't modify the text starting with ---!\n\n" + result)
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 raise 1461 raise
1458 print >> sys.stderr, ( 1462 print >> sys.stderr, (
1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1463 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1464 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1461 return 1 1465 return 1
1462 1466
1463 1467
1464 if __name__ == "__main__": 1468 if __name__ == "__main__":
1465 fix_encoding.fix_encoding() 1469 fix_encoding.fix_encoding()
1466 sys.exit(main(sys.argv[1:])) 1470 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | git_cl.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698