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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 while True: | 136 while True: |
137 # Look in the repository at the current level for the file. | 137 # Look in the repository at the current level for the file. |
138 for _ in range(5): | 138 for _ in range(5): |
139 content = "" | 139 content = "" |
140 try: | 140 try: |
141 # Take advantage of the fact that svn won't output to stderr in case | 141 # Take advantage of the fact that svn won't output to stderr in case |
142 # of success but will do in case of failure so don't mind putting | 142 # of success but will do in case of failure so don't mind putting |
143 # stderr into content_array. | 143 # stderr into content_array. |
144 content_array = [] | 144 content_array = [] |
145 svn_path = url_path + "/" + filename | 145 svn_path = url_path + "/" + filename |
146 SVN.RunAndFilterOutput(['cat', svn_path, '--non-interactive'], '.', | 146 SVN.RunAndFilterOutput(['cat', svn_path, '--non-interactive'], |
147 False, False, content_array.append) | 147 cwd='.', filter_fn=content_array.append) |
148 # Exit the loop if the file was found. Override content. | 148 # Exit the loop if the file was found. Override content. |
149 content = '\n'.join(content_array) | 149 content = '\n'.join(content_array) |
150 break | 150 break |
151 except gclient_utils.Error, e: | 151 except gclient_utils.Error: |
152 if content_array[0].startswith( | 152 if content_array[0].startswith( |
153 'svn: Can\'t get username or password'): | 153 'svn: Can\'t get username or password'): |
154 ErrorExit('Your svn credentials expired. Please run svn update ' | 154 ErrorExit('Your svn credentials expired. Please run svn update ' |
155 'to fix the cached credentials') | 155 'to fix the cached credentials') |
156 if content_array[0].startswith('svn: Can\'t get password'): | 156 if content_array[0].startswith('svn: Can\'t get password'): |
157 ErrorExit('If are using a Mac and svn --version shows 1.4.x, ' | 157 ErrorExit('If are using a Mac and svn --version shows 1.4.x, ' |
158 'please hack gcl.py to remove --non-interactive usage, it\'s' | 158 'please hack gcl.py to remove --non-interactive usage, it\'s' |
159 'a bug on your installed copy') | 159 'a bug on your installed copy') |
160 if not content_array[0].startswith('svn: File not found:'): | 160 if not content_array[0].startswith('svn: File not found:'): |
161 # Try again. | 161 # Try again. |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 return ListFiles(False) | 709 return ListFiles(False) |
710 | 710 |
711 | 711 |
712 @no_args | 712 @no_args |
713 def CMDstatus(): | 713 def CMDstatus(): |
714 """Lists modified and unknown files in the current directory down.""" | 714 """Lists modified and unknown files in the current directory down.""" |
715 return ListFiles(True) | 715 return ListFiles(True) |
716 | 716 |
717 | 717 |
718 @need_change_and_args | 718 @need_change_and_args |
719 @attrs(usage='[--no_presubmit] [--clobber] [--no_watchlists]') | 719 @attrs(usage='[--no_presubmit] [--no_watchlists]') |
720 def CMDupload(change_info, args): | 720 def CMDupload(change_info, args): |
721 """Uploads the changelist to the server for review. | 721 """Uploads the changelist to the server for review. |
722 | 722 |
723 This does not submit a try job; use gcl try to submit a try job. | 723 This does not submit a try job; use gcl try to submit a try job. |
724 """ | 724 """ |
725 if '-s' in args or '--server' in args: | 725 if '-s' in args or '--server' in args: |
726 ErrorExit('Don\'t use the -s flag, fix codereview.settings instead') | 726 ErrorExit('Don\'t use the -s flag, fix codereview.settings instead') |
727 if not change_info.GetFiles(): | 727 if not change_info.GetFiles(): |
728 print "Nothing to upload, changelist is empty." | 728 print "Nothing to upload, changelist is empty." |
729 return 0 | 729 return 0 |
730 if not OptionallyDoPresubmitChecks(change_info, False, args): | 730 if not OptionallyDoPresubmitChecks(change_info, False, args): |
731 return 1 | 731 return 1 |
732 no_watchlists = (FilterFlag(args, "--no_watchlists") or | 732 no_watchlists = (FilterFlag(args, "--no_watchlists") or |
733 FilterFlag(args, "--no-watchlists")) | 733 FilterFlag(args, "--no-watchlists")) |
734 | 734 |
735 # Map --send-mail to --send_mail | 735 # Map --send-mail to --send_mail |
736 if FilterFlag(args, "--send-mail"): | 736 if FilterFlag(args, "--send-mail"): |
737 args.append("--send_mail") | 737 args.append("--send_mail") |
738 | 738 |
739 # Supports --clobber for the try server. | |
740 clobber = FilterFlag(args, "--clobber") | |
741 | |
742 upload_arg = ["upload.py", "-y"] | 739 upload_arg = ["upload.py", "-y"] |
743 server = GetCodeReviewSetting("CODE_REVIEW_SERVER") | 740 server = GetCodeReviewSetting("CODE_REVIEW_SERVER") |
744 if not server: | 741 if not server: |
745 ErrorExit(CODEREVIEW_SETTINGS_FILE_NOT_FOUND) | 742 ErrorExit(CODEREVIEW_SETTINGS_FILE_NOT_FOUND) |
746 upload_arg.append("--server=%s" % server) | 743 upload_arg.append("--server=%s" % server) |
747 upload_arg.extend(args) | 744 upload_arg.extend(args) |
748 | 745 |
749 desc_file = "" | 746 desc_file = "" |
750 if change_info.issue: # Uploading a new patchset. | 747 if change_info.issue: # Uploading a new patchset. |
751 found_message = False | 748 found_message = False |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 if command: | 1313 if command: |
1317 return command(argv[1:]) | 1314 return command(argv[1:]) |
1318 # Unknown command, try to pass that to svn | 1315 # Unknown command, try to pass that to svn |
1319 return CMDpassthru(argv) | 1316 return CMDpassthru(argv) |
1320 except gclient_utils.Error, e: | 1317 except gclient_utils.Error, e: |
1321 print('Got an exception') | 1318 print('Got an exception') |
1322 print(str(e)) | 1319 print(str(e)) |
1323 | 1320 |
1324 if __name__ == "__main__": | 1321 if __name__ == "__main__": |
1325 sys.exit(main(sys.argv[1:])) | 1322 sys.exit(main(sys.argv[1:])) |
OLD | NEW |