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

Side by Side Diff: gcl.py

Issue 6694009: refactor presubmit parsing code from git-cl into presubmit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 9 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 | git_cl/git_cl.py » ('j') | tests/presubmit_unittest.py » ('J')
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) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 """Imports presubmit, then calls presubmit.DoPresubmitChecks.""" 1163 """Imports presubmit, then calls presubmit.DoPresubmitChecks."""
1164 # Need to import here to avoid circular dependency. 1164 # Need to import here to avoid circular dependency.
1165 import presubmit_support 1165 import presubmit_support
1166 root_presubmit = GetCachedFile('PRESUBMIT.py', use_root=True) 1166 root_presubmit = GetCachedFile('PRESUBMIT.py', use_root=True)
1167 change = presubmit_support.SvnChange(change_info.name, 1167 change = presubmit_support.SvnChange(change_info.name,
1168 change_info.description, 1168 change_info.description,
1169 change_info.GetLocalRoot(), 1169 change_info.GetLocalRoot(),
1170 change_info.GetFiles(), 1170 change_info.GetFiles(),
1171 change_info.issue, 1171 change_info.issue,
1172 change_info.patchset) 1172 change_info.patchset)
1173 result = presubmit_support.DoPresubmitChecks(change=change, 1173 output = presubmit_support.DoPresubmitChecks(change=change,
1174 committing=committing, 1174 committing=committing,
1175 verbose=False, 1175 verbose=False,
1176 output_stream=sys.stdout, 1176 output_stream=sys.stdout,
1177 input_stream=sys.stdin, 1177 input_stream=sys.stdin,
1178 default_presubmit=root_presubmit, 1178 default_presubmit=root_presubmit,
1179 may_prompt=may_prompt) 1179 may_prompt=may_prompt)
1180 if not result and may_prompt: 1180 if not output.should_continue() and may_prompt:
1181 # TODO(dpranke): move into DoPresubmitChecks(), unify cmd line args.
1181 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)" 1182 print "\nPresubmit errors, can't continue (use --no_presubmit to bypass)"
1182 return result 1183
1184 # TODO(dpranke): Return the output object and make use of it.
1185 return output.should_continue()
1183 1186
1184 1187
1185 @no_args 1188 @no_args
1186 def CMDchanges(): 1189 def CMDchanges():
1187 """Lists all the changelists and their files.""" 1190 """Lists all the changelists and their files."""
1188 for cl in GetCLs(): 1191 for cl in GetCLs():
1189 change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True) 1192 change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True)
1190 print "\n--- Changelist " + change_info.name + ":" 1193 print "\n--- Changelist " + change_info.name + ":"
1191 for filename in change_info.GetFiles(): 1194 for filename in change_info.GetFiles():
1192 print "".join(filename) 1195 print "".join(filename)
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 if e.code != 500: 1399 if e.code != 500:
1397 raise 1400 raise
1398 print >> sys.stderr, ( 1401 print >> sys.stderr, (
1399 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1402 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1400 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1403 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1401 return 1 1404 return 1
1402 1405
1403 1406
1404 if __name__ == "__main__": 1407 if __name__ == "__main__":
1405 sys.exit(main(sys.argv[1:])) 1408 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | git_cl/git_cl.py » ('j') | tests/presubmit_unittest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698