OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import re | 8 import re |
9 import string | 9 import string |
10 import sys | 10 import sys |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 author = getAuthor(TRUNK_URL, revision) | 588 author = getAuthor(TRUNK_URL, revision) |
589 | 589 |
590 # Check that the author of the CL is different than the user making | 590 # Check that the author of the CL is different than the user making |
591 # the revert. If they're the same, then we'll want to prompt the user | 591 # the revert. If they're the same, then we'll want to prompt the user |
592 # for a different reviewer to TBR. | 592 # for a different reviewer to TBR. |
593 current_users = getCurrentSVNUsers(BASE_URL) | 593 current_users = getCurrentSVNUsers(BASE_URL) |
594 is_self_revert = options.revert and author in current_users | 594 is_self_revert = options.revert and author in current_users |
595 | 595 |
596 filename = str(revision)+".txt" | 596 filename = str(revision)+".txt" |
597 out = open(filename,"w") | 597 out = open(filename,"w") |
598 out.write(action +" " + str(revision) + "\n") | 598 drover_title = '%s %s' % (action, revision) |
599 for line in getRevisionLog(url, revision).splitlines(): | 599 revision_log = getRevisionLog(url, revision).splitlines() |
| 600 if revision_log: |
| 601 commit_title = revision_log[0] |
| 602 # Limit title to 68 chars so git log --oneline is <80 chars. |
| 603 max_commit_title = 68 - (len(drover_title) + 3) |
| 604 if len(commit_title) > max_commit_title: |
| 605 commit_title = commit_title[:max_commit_title-3] + '...' |
| 606 drover_title += ' "%s"' % commit_title |
| 607 out.write(drover_title + '\n\n') |
| 608 for line in revision_log: |
600 out.write('> %s\n' % line) | 609 out.write('> %s\n' % line) |
601 if (author): | 610 if author: |
602 out.write("\nTBR=" + author) | 611 out.write("\nTBR=" + author) |
603 out.close() | 612 out.close() |
604 | 613 |
605 change_cmd = 'change ' + str(revision) + " " + filename | 614 change_cmd = 'change ' + str(revision) + " " + filename |
606 if options.revertbot: | 615 if options.revertbot: |
607 if sys.platform == 'win32': | 616 if sys.platform == 'win32': |
608 os.environ['SVN_EDITOR'] = 'cmd.exe /c exit' | 617 os.environ['SVN_EDITOR'] = 'cmd.exe /c exit' |
609 else: | 618 else: |
610 os.environ['SVN_EDITOR'] = 'true' | 619 os.environ['SVN_EDITOR'] = 'true' |
611 runGcl(change_cmd) | 620 runGcl(change_cmd) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 696 |
688 if options.branch and options.milestone: | 697 if options.branch and options.milestone: |
689 option_parser.error("--branch cannot be used with --milestone") | 698 option_parser.error("--branch cannot be used with --milestone") |
690 return 1 | 699 return 1 |
691 | 700 |
692 return drover(options, args) | 701 return drover(options, args) |
693 | 702 |
694 | 703 |
695 if __name__ == "__main__": | 704 if __name__ == "__main__": |
696 sys.exit(main()) | 705 sys.exit(main()) |
OLD | NEW |