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

Side by Side Diff: apply_issue.py

Issue 264823003: Add black/whitelisting to apply_issue (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 7 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 | checkout.py » ('j') | checkout.py » ('J')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 parser.add_option('--no-auth', action='store_true', 80 parser.add_option('--no-auth', action='store_true',
81 help='Do not attempt authenticated requests.') 81 help='Do not attempt authenticated requests.')
82 parser.add_option('--revision-mapping', default='{}', 82 parser.add_option('--revision-mapping', default='{}',
83 help='When running gclient, annotate the got_revisions ' 83 help='When running gclient, annotate the got_revisions '
84 'using the revision-mapping.') 84 'using the revision-mapping.')
85 parser.add_option('-f', '--force', action='store_true', 85 parser.add_option('-f', '--force', action='store_true',
86 help='Really run apply_issue, even if .update.flag ' 86 help='Really run apply_issue, even if .update.flag '
87 'is detected.') 87 'is detected.')
88 parser.add_option('-b', '--base_ref', help='Base git ref to patch on top of, ' 88 parser.add_option('-b', '--base_ref', help='Base git ref to patch on top of, '
89 'used for verification.') 89 'used for verification.')
90 parser.add_option('--whitelist', action='append',
M-A Ruel 2014/05/06 18:49:08 I recommend using default=[] on both, otherwise op
Ryan Tseng 2014/05/06 19:31:53 Done.
91 help='Patch only specified file(s).')
92 parser.add_option('--blacklist', action='append',
93 help='Don\'t patch specified file(s).')
90 parser.add_option('-d', '--ignore_deps', action='store_true', 94 parser.add_option('-d', '--ignore_deps', action='store_true',
91 help='Don\'t run gclient sync on DEPS changes.') 95 help='Don\'t run gclient sync on DEPS changes.')
92 options, args = parser.parse_args() 96 options, args = parser.parse_args()
93 97
98 if options.whitelist and options.blacklist:
99 parser.error('Cannot specify both --whitelist and --blacklist')
100
94 if options.password and options.private_key_file: 101 if options.password and options.private_key_file:
95 parser.error('-k and -w options are incompatible') 102 parser.error('-k and -w options are incompatible')
96 if options.email and options.email_file: 103 if options.email and options.email_file:
97 parser.error('-e and -E options are incompatible') 104 parser.error('-e and -E options are incompatible')
98 105
99 if (os.path.isfile(os.path.join(os.getcwd(), 'update.flag')) 106 if (os.path.isfile(os.path.join(os.getcwd(), 'update.flag'))
100 and not options.force): 107 and not options.force):
101 print 'update.flag file found: bot_update has run and checkout is already ' 108 print 'update.flag file found: bot_update has run and checkout is already '
102 print 'in a consistent state. No actions will be performed in this step.' 109 print 'in a consistent state. No actions will be performed in this step.'
103 return 0 110 return 0
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 # See sourcedirIsPatched() in: 213 # See sourcedirIsPatched() in:
207 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ 214 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/
208 # chromium_commands.py?view=markup 215 # chromium_commands.py?view=markup
209 open('.buildbot-patched', 'w').close() 216 open('.buildbot-patched', 'w').close()
210 217
211 print('\nApplying the patch.') 218 print('\nApplying the patch.')
212 try: 219 try:
213 scm_obj.apply_patch( 220 scm_obj.apply_patch(
214 patchset, verbose=True, 221 patchset, verbose=True,
215 email=properties.get('owner_email', 'chrome-bot@chromium.org'), 222 email=properties.get('owner_email', 'chrome-bot@chromium.org'),
216 name=properties.get('owner', 'chrome-bot')) 223 name=properties.get('owner', 'chrome-bot'),
224 whitelist=options.whitelist,
225 blacklist=options.blacklist)
217 except checkout.PatchApplicationFailed, e: 226 except checkout.PatchApplicationFailed, e:
218 print(str(e)) 227 print(str(e))
219 print('CWD=%s' % os.getcwd()) 228 print('CWD=%s' % os.getcwd())
220 print('Checkout path=%s' % scm_obj.project_path) 229 print('Checkout path=%s' % scm_obj.project_path)
221 return 1 230 return 1
222 231
223 if ('DEPS' in map(os.path.basename, patchset.filenames) 232 if ('DEPS' in map(os.path.basename, patchset.filenames)
224 and not options.ignore_deps): 233 and not options.ignore_deps):
225 gclient_root = gclient_utils.FindGclientRoot(full_dir) 234 gclient_root = gclient_utils.FindGclientRoot(full_dir)
226 if gclient_root and scm_type: 235 if gclient_root and scm_type:
(...skipping 21 matching lines...) Expand all
248 f, options.revision_mapping) 257 f, options.revision_mapping)
249 annotated_gclient.emit_buildprops(revisions) 258 annotated_gclient.emit_buildprops(revisions)
250 259
251 return retcode 260 return retcode
252 return 0 261 return 0
253 262
254 263
255 if __name__ == "__main__": 264 if __name__ == "__main__":
256 fix_encoding.fix_encoding() 265 fix_encoding.fix_encoding()
257 sys.exit(main()) 266 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | checkout.py » ('j') | checkout.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698