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

Side by Side Diff: gcl.py

Issue 115996: Remove the tree open check since it's now a presubmit script. (Closed)
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
« 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/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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if '__just_initialized' not in CODEREVIEW_SETTINGS: 180 if '__just_initialized' not in CODEREVIEW_SETTINGS:
181 for line in GetCachedFile(CODEREVIEW_SETTINGS_FILE).splitlines(): 181 for line in GetCachedFile(CODEREVIEW_SETTINGS_FILE).splitlines():
182 if not line or line.startswith("#"): 182 if not line or line.startswith("#"):
183 continue 183 continue
184 k, v = line.split(": ", 1) 184 k, v = line.split(": ", 1)
185 CODEREVIEW_SETTINGS[k] = v 185 CODEREVIEW_SETTINGS[k] = v
186 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None) 186 CODEREVIEW_SETTINGS.setdefault('__just_initialized', None)
187 return CODEREVIEW_SETTINGS.get(key, "") 187 return CODEREVIEW_SETTINGS.get(key, "")
188 188
189 189
190 def IsTreeOpen():
191 """Fetches the tree status and returns either True or False."""
192 url = GetCodeReviewSetting('STATUS')
193 status = ""
194 if url:
195 status = urllib2.urlopen(url).read()
196 return status.find('0') == -1
197
198
199 def Warn(msg): 190 def Warn(msg):
200 ErrorExit(msg, exit=False) 191 ErrorExit(msg, exit=False)
201 192
202 193
203 def ErrorExit(msg, exit=True): 194 def ErrorExit(msg, exit=True):
204 """Print an error message to stderr and optionally exit.""" 195 """Print an error message to stderr and optionally exit."""
205 print >>sys.stderr, msg 196 print >>sys.stderr, msg
206 if exit: 197 if exit:
207 sys.exit(1) 198 sys.exit(1)
208 199
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 Basic commands: 591 Basic commands:
601 ----------------------------------------- 592 -----------------------------------------
602 gcl change change_name 593 gcl change change_name
603 Add/remove files to a changelist. Only scans the current directory and 594 Add/remove files to a changelist. Only scans the current directory and
604 subdirectories. 595 subdirectories.
605 596
606 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...] 597 gcl upload change_name [-r reviewer1@gmail.com,reviewer2@gmail.com,...]
607 [--send_mail] [--no_try] [--no_presubmit] 598 [--send_mail] [--no_try] [--no_presubmit]
608 Uploads the changelist to the server for review. 599 Uploads the changelist to the server for review.
609 600
610 gcl commit change_name [--no_presubmit] [--force] 601 gcl commit change_name [--no_presubmit]
611 Commits the changelist to the repository. 602 Commits the changelist to the repository.
612 603
613 gcl lint change_name 604 gcl lint change_name
614 Check all the files in the changelist for possible style violations. 605 Check all the files in the changelist for possible style violations.
615 606
616 Advanced commands: 607 Advanced commands:
617 ----------------------------------------- 608 -----------------------------------------
618 gcl delete change_name 609 gcl delete change_name
619 Deletes a changelist. 610 Deletes a changelist.
620 611
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 if not change_info.FileList(): 857 if not change_info.FileList():
867 print "Nothing to commit, changelist is empty." 858 print "Nothing to commit, changelist is empty."
868 return 859 return
869 860
870 if not "--no_presubmit" in args: 861 if not "--no_presubmit" in args:
871 if not DoPresubmitChecks(change_info, committing=True): 862 if not DoPresubmitChecks(change_info, committing=True):
872 return 863 return
873 else: 864 else:
874 args.remove("--no_presubmit") 865 args.remove("--no_presubmit")
875 866
876 no_tree_status_check = ("--force" in args or "-f" in args)
877 if not no_tree_status_check and not IsTreeOpen():
878 print ("Error: The tree is closed. Try again later or use --force to force"
879 " the commit. May the --force be with you.")
880 return
881
882 commit_cmd = ["svn", "commit", "--non-recursive"] 867 commit_cmd = ["svn", "commit", "--non-recursive"]
883 filename = '' 868 filename = ''
884 if change_info.issue: 869 if change_info.issue:
885 # Get the latest description from Rietveld. 870 # Get the latest description from Rietveld.
886 change_info.description = GetIssueDescription(change_info.issue) 871 change_info.description = GetIssueDescription(change_info.issue)
887 872
888 commit_message = change_info.description.replace('\r\n', '\n') 873 commit_message = change_info.description.replace('\r\n', '\n')
889 if change_info.issue: 874 if change_info.issue:
890 commit_message += ('\nReview URL: http://%s/%s' % 875 commit_message += ('\nReview URL: http://%s/%s' %
891 (GetCodeReviewSetting("CODE_REVIEW_SERVER"), 876 (GetCodeReviewSetting("CODE_REVIEW_SERVER"),
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 # the files. This allows commands such as 'gcl diff xxx' to work. 1125 # the files. This allows commands such as 'gcl diff xxx' to work.
1141 args =["svn", command] 1126 args =["svn", command]
1142 root = GetRepositoryRoot() 1127 root = GetRepositoryRoot()
1143 args.extend([os.path.join(root, x) for x in change_info.FileList()]) 1128 args.extend([os.path.join(root, x) for x in change_info.FileList()])
1144 RunShell(args, True) 1129 RunShell(args, True)
1145 return 0 1130 return 0
1146 1131
1147 1132
1148 if __name__ == "__main__": 1133 if __name__ == "__main__":
1149 sys.exit(main()) 1134 sys.exit(main())
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