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

Side by Side Diff: gcl.py

Issue 8038028: Use universal EOL conversion when calling the text editor in gcl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 | presubmit_support.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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 update_status: if True, the svn status will be updated for all the files 525 update_status: if True, the svn status will be updated for all the files
526 and unchanged files will be removed. 526 and unchanged files will be removed.
527 527
528 Returns: a ChangeInfo object. 528 Returns: a ChangeInfo object.
529 """ 529 """
530 info_file = GetChangelistInfoFile(changename) 530 info_file = GetChangelistInfoFile(changename)
531 if not os.path.exists(info_file): 531 if not os.path.exists(info_file):
532 if fail_on_not_found: 532 if fail_on_not_found:
533 ErrorExit("Changelist " + changename + " not found.") 533 ErrorExit("Changelist " + changename + " not found.")
534 return ChangeInfo(changename, 0, 0, '', None, local_root, None, False) 534 return ChangeInfo(changename, 0, 0, '', None, local_root, None, False)
535 content = gclient_utils.FileRead(info_file, 'r') 535 content = gclient_utils.FileRead(info_file)
536 save = False 536 save = False
537 try: 537 try:
538 values = ChangeInfo._LoadNewFormat(content) 538 values = ChangeInfo._LoadNewFormat(content)
539 except ValueError: 539 except ValueError:
540 try: 540 try:
541 values = ChangeInfo._LoadOldFormat(content) 541 values = ChangeInfo._LoadOldFormat(content)
542 save = True 542 save = True
543 except ValueError: 543 except ValueError:
544 ErrorExit( 544 ErrorExit(
545 ('Changelist file %s is corrupt.\n' 545 ('Changelist file %s is corrupt.\n'
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 cmd = '%s %s' % (GetEditor(), filename) 1130 cmd = '%s %s' % (GetEditor(), filename)
1131 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys': 1131 if sys.platform == 'win32' and os.environ.get('TERM') == 'msys':
1132 # Msysgit requires the usage of 'env' to be present. 1132 # Msysgit requires the usage of 'env' to be present.
1133 cmd = 'env ' + cmd 1133 cmd = 'env ' + cmd
1134 try: 1134 try:
1135 # shell=True to allow the shell to handle all forms of quotes in 1135 # shell=True to allow the shell to handle all forms of quotes in
1136 # $EDITOR. 1136 # $EDITOR.
1137 subprocess2.check_call(cmd, shell=True) 1137 subprocess2.check_call(cmd, shell=True)
1138 except subprocess2.CalledProcessError, e: 1138 except subprocess2.CalledProcessError, e:
1139 ErrorExit('Editor returned %d' % e.returncode) 1139 ErrorExit('Editor returned %d' % e.returncode)
1140 result = gclient_utils.FileRead(filename, 'r') 1140 result = gclient_utils.FileRead(filename)
1141 finally: 1141 finally:
1142 os.remove(filename) 1142 os.remove(filename)
1143 1143
1144 if not result: 1144 if not result:
1145 return 0 1145 return 0
1146 1146
1147 split_result = result.split(separator1, 1) 1147 split_result = result.split(separator1, 1)
1148 if len(split_result) != 2: 1148 if len(split_result) != 2:
1149 ErrorExit("Don't modify the text starting with ---!\n\n" + result) 1149 ErrorExit("Don't modify the text starting with ---!\n\n" + result)
1150 1150
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 raise 1479 raise
1480 print >> sys.stderr, ( 1480 print >> sys.stderr, (
1481 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1481 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1482 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1482 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1483 return 1 1483 return 1
1484 1484
1485 1485
1486 if __name__ == "__main__": 1486 if __name__ == "__main__":
1487 fix_encoding.fix_encoding() 1487 fix_encoding.fix_encoding()
1488 sys.exit(main(sys.argv[1:])) 1488 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698