| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 """ | 438 """ |
| 439 info_file = GetChangelistInfoFile(changename) | 439 info_file = GetChangelistInfoFile(changename) |
| 440 if not os.path.exists(info_file): | 440 if not os.path.exists(info_file): |
| 441 if fail_on_not_found: | 441 if fail_on_not_found: |
| 442 ErrorExit("Changelist " + changename + " not found.") | 442 ErrorExit("Changelist " + changename + " not found.") |
| 443 return ChangeInfo(changename, 0, 0, '', None, local_root, | 443 return ChangeInfo(changename, 0, 0, '', None, local_root, |
| 444 needs_upload=False) | 444 needs_upload=False) |
| 445 split_data = gclient_utils.FileRead(info_file, 'r').split( | 445 split_data = gclient_utils.FileRead(info_file, 'r').split( |
| 446 ChangeInfo._SEPARATOR, 2) | 446 ChangeInfo._SEPARATOR, 2) |
| 447 if len(split_data) != 3: | 447 if len(split_data) != 3: |
| 448 ErrorExit("Changelist file %s is corrupt" % info_file) | 448 ErrorExit( |
| 449 ('Changelist file %s is corrupt.\n' |
| 450 'Either run "gcl delete %s" or manually edit the file') % ( |
| 451 info_file, changename)) |
| 449 items = split_data[0].split(', ') | 452 items = split_data[0].split(', ') |
| 450 issue = 0 | 453 issue = 0 |
| 451 patchset = 0 | 454 patchset = 0 |
| 452 needs_upload = False | 455 needs_upload = False |
| 453 if items[0]: | 456 if items[0]: |
| 454 issue = int(items[0]) | 457 issue = int(items[0]) |
| 455 if len(items) > 1: | 458 if len(items) > 1: |
| 456 patchset = int(items[1]) | 459 patchset = int(items[1]) |
| 457 if len(items) > 2: | 460 if len(items) > 2: |
| 458 needs_upload = (items[2] == "dirty") | 461 needs_upload = (items[2] == "dirty") |
| 459 files = [] | 462 files = [] |
| 460 for line in split_data[1].splitlines(): | 463 for line in split_data[1].splitlines(): |
| 461 status = line[:7] | 464 status = line[:7] |
| 462 filename = line[7:] | 465 filename = line[7:] |
| 463 files.append((status, filename)) | 466 files.append((status, filename)) |
| 464 description = split_data[2] | 467 description = split_data[2] |
| 465 save = False | 468 save = False |
| 466 if update_status: | 469 if update_status: |
| 467 for item in files: | 470 for item in files[:]: |
| 468 filename = os.path.join(local_root, item[1]) | 471 filename = os.path.join(local_root, item[1]) |
| 469 status_result = SVN.CaptureStatus(filename) | 472 status_result = SVN.CaptureStatus(filename) |
| 470 if not status_result or not status_result[0][0]: | 473 if not status_result or not status_result[0][0]: |
| 471 # File has been reverted. | 474 # File has been reverted. |
| 472 save = True | 475 save = True |
| 473 files.remove(item) | 476 files.remove(item) |
| 474 continue | 477 continue |
| 475 status = status_result[0][0] | 478 status = status_result[0][0] |
| 476 if status != item[0]: | 479 if status != item[0]: |
| 477 save = True | 480 save = True |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 return 0 | 1189 return 0 |
| 1187 | 1190 |
| 1188 | 1191 |
| 1189 @need_change | 1192 @need_change |
| 1190 def CMDdescription(change_info): | 1193 def CMDdescription(change_info): |
| 1191 """Prints the description of the specified change to stdout.""" | 1194 """Prints the description of the specified change to stdout.""" |
| 1192 print change_info.description | 1195 print change_info.description |
| 1193 return 0 | 1196 return 0 |
| 1194 | 1197 |
| 1195 | 1198 |
| 1196 @need_change | 1199 def CMDdelete(args): |
| 1197 def CMDdelete(change_info): | |
| 1198 """Deletes a changelist.""" | 1200 """Deletes a changelist.""" |
| 1199 change_info.Delete() | 1201 if not len(args) == 1: |
| 1202 ErrorExit('You need to pass a change list name') |
| 1203 os.remove(GetChangelistInfoFile(args[0])) |
| 1200 return 0 | 1204 return 0 |
| 1201 | 1205 |
| 1202 | 1206 |
| 1203 def CMDtry(args): | 1207 def CMDtry(args): |
| 1204 """Sends the change to the tryserver to do a test run on your code. | 1208 """Sends the change to the tryserver to do a test run on your code. |
| 1205 | 1209 |
| 1206 To send multiple changes as one path, use a comma-separated list of | 1210 To send multiple changes as one path, use a comma-separated list of |
| 1207 changenames. Use 'gcl help try' for more information!""" | 1211 changenames. Use 'gcl help try' for more information!""" |
| 1208 # When the change contains no file, send the "changename" positional | 1212 # When the change contains no file, send the "changename" positional |
| 1209 # argument to trychange.py. | 1213 # argument to trychange.py. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1337 if e.code != 500: | 1341 if e.code != 500: |
| 1338 raise | 1342 raise |
| 1339 print >> sys.stderr, ( | 1343 print >> sys.stderr, ( |
| 1340 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' | 1344 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' |
| 1341 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) | 1345 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) |
| 1342 return 1 | 1346 return 1 |
| 1343 | 1347 |
| 1344 | 1348 |
| 1345 if __name__ == "__main__": | 1349 if __name__ == "__main__": |
| 1346 sys.exit(main(sys.argv[1:])) | 1350 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |