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

Side by Side Diff: gcl.py

Issue 118432: Add watchlists to 'gcl upload'... (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 11 years, 6 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 | « WATCHLISTS ('k') | watchlists.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/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 # Wrapper script around Rietveld's upload.py that groups files into 6 # Wrapper script around Rietveld's upload.py that groups files into
7 # changelists. 7 # changelists.
8 8
9 import getpass 9 import getpass
10 import os 10 import os
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 version """ + __version__ + """ 608 version """ + __version__ + """
609 609
610 Basic commands: 610 Basic commands:
611 ----------------------------------------- 611 -----------------------------------------
612 gcl change change_name 612 gcl change change_name
613 Add/remove files to a changelist. Only scans the current directory and 613 Add/remove files to a changelist. Only scans the current directory and
614 subdirectories. 614 subdirectories.
615 615
616 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...] 616 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...]
617 [--send_mail] [--no_try] [--no_presubmit] 617 [--send_mail] [--no_try] [--no_presubmit]
618 [--no_watchlists]
618 Uploads the changelist to the server for review. 619 Uploads the changelist to the server for review.
619 620
620 gcl commit change_name [--no_presubmit] 621 gcl commit change_name [--no_presubmit]
621 Commits the changelist to the repository. 622 Commits the changelist to the repository.
622 623
623 gcl lint change_name 624 gcl lint change_name
624 Check all the files in the changelist for possible style violations. 625 Check all the files in the changelist for possible style violations.
625 626
626 Advanced commands: 627 Advanced commands:
627 ----------------------------------------- 628 -----------------------------------------
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 return DoPresubmitChecks(change_info, committing, True) 732 return DoPresubmitChecks(change_info, committing, True)
732 733
733 734
734 def UploadCL(change_info, args): 735 def UploadCL(change_info, args):
735 if not change_info.FileList(): 736 if not change_info.FileList():
736 print "Nothing to upload, changelist is empty." 737 print "Nothing to upload, changelist is empty."
737 return 738 return
738 if not OptionallyDoPresubmitChecks(change_info, False, args): 739 if not OptionallyDoPresubmitChecks(change_info, False, args):
739 return 740 return
740 no_try = FilterFlag(args, "--no_try") or FilterFlag(args, "--no-try") 741 no_try = FilterFlag(args, "--no_try") or FilterFlag(args, "--no-try")
742 no_watchlists = FilterFlag(args, "--no_watchlists") or \
743 FilterFlag(args, "--no-watchlists")
741 744
742 # Map --send-mail to --send_mail 745 # Map --send-mail to --send_mail
743 if FilterFlag(args, "--send-mail"): 746 if FilterFlag(args, "--send-mail"):
744 args.append("--send_mail") 747 args.append("--send_mail")
745 748
746 # Supports --clobber for the try server. 749 # Supports --clobber for the try server.
747 clobber = FilterFlag(args, "--clobber") 750 clobber = FilterFlag(args, "--clobber")
748 751
749 # Disable try when the server is overridden. 752 # Disable try when the server is overridden.
750 server_1 = re.compile(r"^-s\b.*") 753 server_1 = re.compile(r"^-s\b.*")
(...skipping 17 matching lines...) Expand all
768 771
769 if not found_message: 772 if not found_message:
770 upload_arg.append("--message=''") 773 upload_arg.append("--message=''")
771 774
772 upload_arg.append("--issue=%d" % change_info.issue) 775 upload_arg.append("--issue=%d" % change_info.issue)
773 else: # First time we upload. 776 else: # First time we upload.
774 handle, desc_file = tempfile.mkstemp(text=True) 777 handle, desc_file = tempfile.mkstemp(text=True)
775 os.write(handle, change_info.description) 778 os.write(handle, change_info.description)
776 os.close(handle) 779 os.close(handle)
777 780
781 # Watchlist processing -- CC people interested in this changeset
782 # http://dev.chromium.org/developers/contributing-code/watchlists
783 if not no_watchlists:
784 import watchlists
785 watchlist = watchlists.Watchlists(GetRepositoryRoot())
786 watchers = watchlist.GetWatchersForPaths(change_info.FileList())
787
778 cc_list = GetCodeReviewSetting("CC_LIST") 788 cc_list = GetCodeReviewSetting("CC_LIST")
789 if not no_watchlists and watchers:
790 # Filter out all empty elements and join by ','
791 cc_list = ','.join(filter(None, [cc_list] + watchers))
779 if cc_list: 792 if cc_list:
780 upload_arg.append("--cc=" + cc_list) 793 upload_arg.append("--cc=" + cc_list)
781 upload_arg.append("--description_file=" + desc_file + "") 794 upload_arg.append("--description_file=" + desc_file + "")
782 if change_info.description: 795 if change_info.description:
783 subject = change_info.description[:77] 796 subject = change_info.description[:77]
784 if subject.find("\r\n") != -1: 797 if subject.find("\r\n") != -1:
785 subject = subject[:subject.find("\r\n")] 798 subject = subject[:subject.find("\r\n")]
786 if subject.find("\n") != -1: 799 if subject.find("\n") != -1:
787 subject = subject[:subject.find("\n")] 800 subject = subject[:subject.find("\n")]
788 if len(change_info.description) > 77: 801 if len(change_info.description) > 77:
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 # the files. This allows commands such as 'gcl diff xxx' to work. 1170 # the files. This allows commands such as 'gcl diff xxx' to work.
1158 args =["svn", command] 1171 args =["svn", command]
1159 root = GetRepositoryRoot() 1172 root = GetRepositoryRoot()
1160 args.extend([os.path.join(root, x) for x in change_info.FileList()]) 1173 args.extend([os.path.join(root, x) for x in change_info.FileList()])
1161 RunShell(args, True) 1174 RunShell(args, True)
1162 return 0 1175 return 0
1163 1176
1164 1177
1165 if __name__ == "__main__": 1178 if __name__ == "__main__":
1166 sys.exit(main()) 1179 sys.exit(main())
OLDNEW
« no previous file with comments | « WATCHLISTS ('k') | watchlists.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698