| 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 """\ | 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 29 matching lines...) Expand all Loading... |
| 40 # To make gcl send reviews to a server, check in a file named | 40 # To make gcl send reviews to a server, check in a file named |
| 41 # "codereview.settings" (see |CODEREVIEW_SETTINGS_FILE| below) to your | 41 # "codereview.settings" (see |CODEREVIEW_SETTINGS_FILE| below) to your |
| 42 # project's base directory and add the following line to codereview.settings: | 42 # project's base directory and add the following line to codereview.settings: |
| 43 # CODE_REVIEW_SERVER: codereview.yourserver.org | 43 # CODE_REVIEW_SERVER: codereview.yourserver.org |
| 44 } | 44 } |
| 45 | 45 |
| 46 # globals that store the root of the current repository and the directory where | 46 # globals that store the root of the current repository and the directory where |
| 47 # we store information about changelists. | 47 # we store information about changelists. |
| 48 REPOSITORY_ROOT = "" | 48 REPOSITORY_ROOT = "" |
| 49 | 49 |
| 50 # Replacement for project name. |
| 51 SWITCH_TO_GIT = "SWITCH_TO_GIT_ALREADY" |
| 52 |
| 50 # Filename where we store repository specific information for gcl. | 53 # Filename where we store repository specific information for gcl. |
| 51 CODEREVIEW_SETTINGS_FILE = "codereview.settings" | 54 CODEREVIEW_SETTINGS_FILE = "codereview.settings" |
| 52 CODEREVIEW_SETTINGS_FILE_NOT_FOUND = ( | 55 CODEREVIEW_SETTINGS_FILE_NOT_FOUND = ( |
| 53 'No %s file found. Please add one.' % CODEREVIEW_SETTINGS_FILE) | 56 'No %s file found. Please add one.' % CODEREVIEW_SETTINGS_FILE) |
| 54 | 57 |
| 55 # Warning message when the change appears to be missing tests. | 58 # Warning message when the change appears to be missing tests. |
| 56 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!" | 59 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!" |
| 57 | 60 |
| 58 # Global cache of files cached in GetCacheDir(). | 61 # Global cache of files cached in GetCacheDir(). |
| 59 FILES_CACHE = {} | 62 FILES_CACHE = {} |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) | 875 upload_arg.append('--reviewers=%s' % ','.join(reviewers)) |
| 873 | 876 |
| 874 upload_arg.extend(args) | 877 upload_arg.extend(args) |
| 875 | 878 |
| 876 desc_file = None | 879 desc_file = None |
| 877 try: | 880 try: |
| 878 if change_info.issue: | 881 if change_info.issue: |
| 879 # Uploading a new patchset. | 882 # Uploading a new patchset. |
| 880 upload_arg.append("--issue=%d" % change_info.issue) | 883 upload_arg.append("--issue=%d" % change_info.issue) |
| 881 | 884 |
| 885 project = GetCodeReviewSetting("PROJECT") |
| 886 if project: |
| 887 upload_arg.append("--project=%s" % SWITCH_TO_GIT) |
| 888 |
| 882 if not any(i.startswith('--title') or i.startswith('-t') for i in args): | 889 if not any(i.startswith('--title') or i.startswith('-t') for i in args): |
| 883 upload_arg.append('--title= ') | 890 upload_arg.append('--title= ') |
| 884 else: | 891 else: |
| 885 # First time we upload. | 892 # First time we upload. |
| 886 handle, desc_file = tempfile.mkstemp(text=True) | 893 handle, desc_file = tempfile.mkstemp(text=True) |
| 887 os.write(handle, change_info.description) | 894 os.write(handle, change_info.description) |
| 888 os.close(handle) | 895 os.close(handle) |
| 889 | 896 |
| 890 # Watchlist processing -- CC people interested in this changeset | 897 # Watchlist processing -- CC people interested in this changeset |
| 891 # http://dev.chromium.org/developers/contributing-code/watchlists | 898 # http://dev.chromium.org/developers/contributing-code/watchlists |
| (...skipping 20 matching lines...) Expand all Loading... |
| 912 cc_list = ','.join(filter(None, [cc_list] + watchers)) | 919 cc_list = ','.join(filter(None, [cc_list] + watchers)) |
| 913 if cc_list: | 920 if cc_list: |
| 914 upload_arg.append("--cc=" + cc_list) | 921 upload_arg.append("--cc=" + cc_list) |
| 915 upload_arg.append("--file=%s" % desc_file) | 922 upload_arg.append("--file=%s" % desc_file) |
| 916 | 923 |
| 917 if GetCodeReviewSetting("PRIVATE") == "True": | 924 if GetCodeReviewSetting("PRIVATE") == "True": |
| 918 upload_arg.append("--private") | 925 upload_arg.append("--private") |
| 919 | 926 |
| 920 project = GetCodeReviewSetting("PROJECT") | 927 project = GetCodeReviewSetting("PROJECT") |
| 921 if project: | 928 if project: |
| 922 upload_arg.append("--project=%s" % project) | 929 upload_arg.append("--project=%s" % SWITCH_TO_GIT) |
| 923 | 930 |
| 924 # If we have a lot of files with long paths, then we won't be able to fit | 931 # If we have a lot of files with long paths, then we won't be able to fit |
| 925 # the command to "svn diff". Instead, we generate the diff manually for | 932 # the command to "svn diff". Instead, we generate the diff manually for |
| 926 # each file and concatenate them before passing it to upload.py. | 933 # each file and concatenate them before passing it to upload.py. |
| 927 if change_info.patch is None: | 934 if change_info.patch is None: |
| 928 change_info.patch = GenerateDiff(change_info.GetFileNames()) | 935 change_info.patch = GenerateDiff(change_info.GetFileNames()) |
| 929 | 936 |
| 930 # Change the current working directory before calling upload.py so that it | 937 # Change the current working directory before calling upload.py so that it |
| 931 # shows the correct base. | 938 # shows the correct base. |
| 932 previous_cwd = os.getcwd() | 939 previous_cwd = os.getcwd() |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 return 1 | 1524 return 1 |
| 1518 | 1525 |
| 1519 | 1526 |
| 1520 if __name__ == "__main__": | 1527 if __name__ == "__main__": |
| 1521 fix_encoding.fix_encoding() | 1528 fix_encoding.fix_encoding() |
| 1522 try: | 1529 try: |
| 1523 sys.exit(main(sys.argv[1:])) | 1530 sys.exit(main(sys.argv[1:])) |
| 1524 except KeyboardInterrupt: | 1531 except KeyboardInterrupt: |
| 1525 sys.stderr.write('interrupted\n') | 1532 sys.stderr.write('interrupted\n') |
| 1526 sys.exit(1) | 1533 sys.exit(1) |
| OLD | NEW |