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

Side by Side Diff: apply_issue.py

Issue 171763003: Apply Issue shim for disabling checkout when bot update ran. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Add --force flag and --git_ref flag Created 6 years, 10 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 | checkout.py » ('j') | 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 """Applies an issue from Rietveld. 6 """Applies an issue from Rietveld.
7 """ 7 """
8 8
9 import getpass 9 import getpass
10 import json 10 import json
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 parser.add_option( 65 parser.add_option(
66 '-s', 66 '-s',
67 '--server', 67 '--server',
68 default='http://codereview.chromium.org', 68 default='http://codereview.chromium.org',
69 help='Rietveld server') 69 help='Rietveld server')
70 parser.add_option('--no-auth', action='store_true', 70 parser.add_option('--no-auth', action='store_true',
71 help='Do not attempt authenticated requests.') 71 help='Do not attempt authenticated requests.')
72 parser.add_option('--revision-mapping', default='{}', 72 parser.add_option('--revision-mapping', default='{}',
73 help='When running gclient, annotate the got_revisions ' 73 help='When running gclient, annotate the got_revisions '
74 'using the revision-mapping.') 74 'using the revision-mapping.')
75 parser.add_option('-f', '--force', action='store_true',
76 help='Really run apply_issue, even if .update.flag '
77 'is detected.')
78 parser.add_option('-b', '--base_ref', help='Base git ref to patch on top of, '
79 'used for verification.')
75 options, args = parser.parse_args() 80 options, args = parser.parse_args()
81 if (os.path.isfile(os.path.join(os.getcwd(), 'update.flag'))
82 and not options.force):
83 print 'update.flag file found: bot_update has run and checkout is already '
84 print 'in a consistent state. No actions will be performed in this step.'
85 return 0
76 logging.basicConfig( 86 logging.basicConfig(
77 format='%(levelname)5s %(module)11s(%(lineno)4d): %(message)s', 87 format='%(levelname)5s %(module)11s(%(lineno)4d): %(message)s',
78 level=[logging.WARNING, logging.INFO, logging.DEBUG][ 88 level=[logging.WARNING, logging.INFO, logging.DEBUG][
79 min(2, options.verbose)]) 89 min(2, options.verbose)])
80 if args: 90 if args:
81 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args)) 91 parser.error('Extra argument(s) "%s" not understood' % ' '.join(args))
82 if not options.issue: 92 if not options.issue:
83 parser.error('Require --issue') 93 parser.error('Require --issue')
84 options.server = options.server.rstrip('/') 94 options.server = options.server.rstrip('/')
85 if not options.server: 95 if not options.server:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 options.issue, options.patchset, 154 options.issue, options.patchset,
145 options.server, options.issue) 155 options.server, options.issue)
146 return 1 156 return 1
147 for patch in patchset.patches: 157 for patch in patchset.patches:
148 print(patch) 158 print(patch)
149 full_dir = os.path.abspath(options.root_dir) 159 full_dir = os.path.abspath(options.root_dir)
150 scm_type = scm.determine_scm(full_dir) 160 scm_type = scm.determine_scm(full_dir)
151 if scm_type == 'svn': 161 if scm_type == 'svn':
152 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) 162 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None)
153 elif scm_type == 'git': 163 elif scm_type == 'git':
154 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None) 164 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None,
165 base_ref=options.base_ref)
155 elif scm_type == None: 166 elif scm_type == None:
156 scm_obj = checkout.RawCheckout(full_dir, None, None) 167 scm_obj = checkout.RawCheckout(full_dir, None, None)
157 else: 168 else:
158 parser.error('Couldn\'t determine the scm') 169 parser.error('Couldn\'t determine the scm')
159 170
160 # TODO(maruel): HACK, remove me. 171 # TODO(maruel): HACK, remove me.
161 # When run a build slave, make sure buildbot knows that the checkout was 172 # When run a build slave, make sure buildbot knows that the checkout was
162 # modified. 173 # modified.
163 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': 174 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot':
164 # See sourcedirIsPatched() in: 175 # See sourcedirIsPatched() in:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 f, options.revision_mapping) 213 f, options.revision_mapping)
203 annotated_gclient.emit_buildprops(revisions) 214 annotated_gclient.emit_buildprops(revisions)
204 215
205 return retcode 216 return retcode
206 return 0 217 return 0
207 218
208 219
209 if __name__ == "__main__": 220 if __name__ == "__main__":
210 fix_encoding.fix_encoding() 221 fix_encoding.fix_encoding()
211 sys.exit(main()) 222 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | checkout.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698