OLD | NEW |
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import optparse | 5 import optparse |
6 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 import webbrowser | 10 import webbrowser |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 deleteRevision(url, revision) | 470 deleteRevision(url, revision) |
471 elif options.revert: | 471 elif options.revert: |
472 action = "Revert" | 472 action = "Revert" |
473 if options.branch: | 473 if options.branch: |
474 url = BRANCH_URL.replace("$branch", options.branch) | 474 url = BRANCH_URL.replace("$branch", options.branch) |
475 checkoutRevision(url, revision, url, True) | 475 checkoutRevision(url, revision, url, True) |
476 revertRevision(url, revision) | 476 revertRevision(url, revision) |
477 revertExportRevision(url, revision) | 477 revertExportRevision(url, revision) |
478 | 478 |
479 # Check the base url so we actually find the author who made the change | 479 # Check the base url so we actually find the author who made the change |
480 author = getAuthor(url, revision) | 480 if options.auditor: |
| 481 author = options.auditor |
| 482 else: |
| 483 author = getAuthor(url, revision) |
| 484 if not author: |
| 485 author = getAuthor(TRUNK_URL, revision) |
481 | 486 |
482 filename = str(revision)+".txt" | 487 filename = str(revision)+".txt" |
483 out = open(filename,"w") | 488 out = open(filename,"w") |
484 out.write(action +" " + str(revision) + " - ") | 489 out.write(action +" " + str(revision) + " - ") |
485 out.write(getRevisionLog(url, revision)) | 490 out.write(getRevisionLog(url, revision)) |
486 if (author): | 491 if (author): |
487 out.write("TBR=" + author) | 492 out.write("TBR=" + author) |
488 out.close() | 493 out.close() |
489 | 494 |
490 change_cmd = 'change ' + str(revision) + " " + filename | 495 change_cmd = 'change ' + str(revision) + " " + filename |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 option_parser.add_option('-m', '--merge', type="int", | 530 option_parser.add_option('-m', '--merge', type="int", |
526 help='Revision to merge from trunk to branch') | 531 help='Revision to merge from trunk to branch') |
527 option_parser.add_option('-b', '--branch', | 532 option_parser.add_option('-b', '--branch', |
528 help='Branch to revert or merge from') | 533 help='Branch to revert or merge from') |
529 option_parser.add_option('-s', '--sbranch', | 534 option_parser.add_option('-s', '--sbranch', |
530 help='Source branch for merge') | 535 help='Source branch for merge') |
531 option_parser.add_option('-r', '--revert', type="int", | 536 option_parser.add_option('-r', '--revert', type="int", |
532 help='Revision to revert') | 537 help='Revision to revert') |
533 option_parser.add_option('-w', '--workdir', | 538 option_parser.add_option('-w', '--workdir', |
534 help='subdir to use for the revert') | 539 help='subdir to use for the revert') |
| 540 option_parser.add_option('-a', '--auditor', |
| 541 help='overrides the author for reviewer')
|
535 option_parser.add_option('', '--revertbot', action='store_true', | 542 option_parser.add_option('', '--revertbot', action='store_true', |
536 default=False) | 543 default=False) |
537 option_parser.add_option('', '--revertbot-commit', action='store_true', | 544 option_parser.add_option('', '--revertbot-commit', action='store_true', |
538 default=False) | 545 default=False) |
539 option_parser.add_option('', '--revertbot-reviewers') | 546 option_parser.add_option('', '--revertbot-reviewers') |
540 options, args = option_parser.parse_args() | 547 options, args = option_parser.parse_args() |
541 | 548 |
542 if not options.merge and not options.revert: | 549 if not options.merge and not options.revert: |
543 option_parser.error("You need at least --merge or --revert") | 550 option_parser.error("You need at least --merge or --revert") |
544 sys.exit(1) | 551 sys.exit(1) |
545 | 552 |
546 if options.merge and not options.branch: | 553 if options.merge and not options.branch: |
547 option_parser.error("--merge requires a --branch") | 554 option_parser.error("--merge requires a --branch") |
548 sys.exit(1) | 555 sys.exit(1) |
549 | 556 |
550 sys.exit(main(options, args)) | 557 sys.exit(main(options, args)) |
OLD | NEW |