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

Side by Side Diff: gcl.py

Issue 1404363004: Make gcl uploading work again. (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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/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
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. 50 # Printed when people upload patches using svn.
51 SWITCH_TO_GIT = "SWITCH_TO_GIT_ALREADY" 51 SWITCH_TO_GIT = """You're using svn to work on depot_tools.
52 Consider switching to git today, so that you're ready when svn stops working
53 and you need a functional checkout for a future fire."""
52 54
53 # Filename where we store repository specific information for gcl. 55 # Filename where we store repository specific information for gcl.
54 CODEREVIEW_SETTINGS_FILE = "codereview.settings" 56 CODEREVIEW_SETTINGS_FILE = "codereview.settings"
55 CODEREVIEW_SETTINGS_FILE_NOT_FOUND = ( 57 CODEREVIEW_SETTINGS_FILE_NOT_FOUND = (
56 'No %s file found. Please add one.' % CODEREVIEW_SETTINGS_FILE) 58 'No %s file found. Please add one.' % CODEREVIEW_SETTINGS_FILE)
57 59
58 # Warning message when the change appears to be missing tests. 60 # Warning message when the change appears to be missing tests.
59 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!" 61 MISSING_TEST_MSG = "Change contains new or modified methods, but no new tests!"
60 62
61 # Global cache of files cached in GetCacheDir(). 63 # Global cache of files cached in GetCacheDir().
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 upload_arg.extend(args) 879 upload_arg.extend(args)
878 880
879 desc_file = None 881 desc_file = None
880 try: 882 try:
881 if change_info.issue: 883 if change_info.issue:
882 # Uploading a new patchset. 884 # Uploading a new patchset.
883 upload_arg.append("--issue=%d" % change_info.issue) 885 upload_arg.append("--issue=%d" % change_info.issue)
884 886
885 project = GetCodeReviewSetting("PROJECT") 887 project = GetCodeReviewSetting("PROJECT")
886 if project: 888 if project:
887 upload_arg.append("--project=%s" % SWITCH_TO_GIT) 889 print SWITCH_TO_GIT
890 upload_arg.append("--project=%s" % project)
888 891
889 if not any(i.startswith('--title') or i.startswith('-t') for i in args): 892 if not any(i.startswith('--title') or i.startswith('-t') for i in args):
890 upload_arg.append('--title= ') 893 upload_arg.append('--title= ')
891 else: 894 else:
892 # First time we upload. 895 # First time we upload.
893 handle, desc_file = tempfile.mkstemp(text=True) 896 handle, desc_file = tempfile.mkstemp(text=True)
894 os.write(handle, change_info.description) 897 os.write(handle, change_info.description)
895 os.close(handle) 898 os.close(handle)
896 899
897 # Watchlist processing -- CC people interested in this changeset 900 # Watchlist processing -- CC people interested in this changeset
(...skipping 21 matching lines...) Expand all
919 cc_list = ','.join(filter(None, [cc_list] + watchers)) 922 cc_list = ','.join(filter(None, [cc_list] + watchers))
920 if cc_list: 923 if cc_list:
921 upload_arg.append("--cc=" + cc_list) 924 upload_arg.append("--cc=" + cc_list)
922 upload_arg.append("--file=%s" % desc_file) 925 upload_arg.append("--file=%s" % desc_file)
923 926
924 if GetCodeReviewSetting("PRIVATE") == "True": 927 if GetCodeReviewSetting("PRIVATE") == "True":
925 upload_arg.append("--private") 928 upload_arg.append("--private")
926 929
927 project = GetCodeReviewSetting("PROJECT") 930 project = GetCodeReviewSetting("PROJECT")
928 if project: 931 if project:
929 upload_arg.append("--project=%s" % SWITCH_TO_GIT) 932 print SWITCH_TO_GIT
933 upload_arg.append("--project=%s" % project)
930 934
931 # If we have a lot of files with long paths, then we won't be able to fit 935 # If we have a lot of files with long paths, then we won't be able to fit
932 # the command to "svn diff". Instead, we generate the diff manually for 936 # the command to "svn diff". Instead, we generate the diff manually for
933 # each file and concatenate them before passing it to upload.py. 937 # each file and concatenate them before passing it to upload.py.
934 if change_info.patch is None: 938 if change_info.patch is None:
935 change_info.patch = GenerateDiff(change_info.GetFileNames()) 939 change_info.patch = GenerateDiff(change_info.GetFileNames())
936 940
937 # Change the current working directory before calling upload.py so that it 941 # Change the current working directory before calling upload.py so that it
938 # shows the correct base. 942 # shows the correct base.
939 previous_cwd = os.getcwd() 943 previous_cwd = os.getcwd()
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 return 1 1528 return 1
1525 1529
1526 1530
1527 if __name__ == "__main__": 1531 if __name__ == "__main__":
1528 fix_encoding.fix_encoding() 1532 fix_encoding.fix_encoding()
1529 try: 1533 try:
1530 sys.exit(main(sys.argv[1:])) 1534 sys.exit(main(sys.argv[1:]))
1531 except KeyboardInterrupt: 1535 except KeyboardInterrupt:
1532 sys.stderr.write('interrupted\n') 1536 sys.stderr.write('interrupted\n')
1533 sys.exit(1) 1537 sys.exit(1)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698