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

Side by Side Diff: apply_issue.py

Issue 271283003: Revert of Have apply_patch.py/checkout.py stage git patches instead of committing them (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') | 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 default='http://codereview.chromium.org', 78 default='http://codereview.chromium.org',
79 help='Rietveld server') 79 help='Rietveld server')
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, '
89 'used for verification.')
88 parser.add_option('--whitelist', action='append', default=[], 90 parser.add_option('--whitelist', action='append', default=[],
89 help='Patch only specified file(s).') 91 help='Patch only specified file(s).')
90 parser.add_option('--blacklist', action='append', default=[], 92 parser.add_option('--blacklist', action='append', default=[],
91 help='Don\'t patch specified file(s).') 93 help='Don\'t patch specified file(s).')
92 parser.add_option('-d', '--ignore_deps', action='store_true', 94 parser.add_option('-d', '--ignore_deps', action='store_true',
93 help='Don\'t run gclient sync on DEPS changes.') 95 help='Don\'t run gclient sync on DEPS changes.')
94 options, args = parser.parse_args() 96 options, args = parser.parse_args()
95 97
96 if options.whitelist and options.blacklist: 98 if options.whitelist and options.blacklist:
97 parser.error('Cannot specify both --whitelist and --blacklist') 99 parser.error('Cannot specify both --whitelist and --blacklist')
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 if options.blacklist: 198 if options.blacklist:
197 patchset.patches = [patch for patch in patchset.patches 199 patchset.patches = [patch for patch in patchset.patches
198 if patch.filename not in options.blacklist] 200 if patch.filename not in options.blacklist]
199 for patch in patchset.patches: 201 for patch in patchset.patches:
200 print(patch) 202 print(patch)
201 full_dir = os.path.abspath(options.root_dir) 203 full_dir = os.path.abspath(options.root_dir)
202 scm_type = scm.determine_scm(full_dir) 204 scm_type = scm.determine_scm(full_dir)
203 if scm_type == 'svn': 205 if scm_type == 'svn':
204 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None) 206 scm_obj = checkout.SvnCheckout(full_dir, None, None, None, None)
205 elif scm_type == 'git': 207 elif scm_type == 'git':
206 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None) 208 scm_obj = checkout.GitCheckout(full_dir, None, None, None, None,
209 base_ref=options.base_ref,)
207 elif scm_type == None: 210 elif scm_type == None:
208 scm_obj = checkout.RawCheckout(full_dir, None, None) 211 scm_obj = checkout.RawCheckout(full_dir, None, None)
209 else: 212 else:
210 parser.error('Couldn\'t determine the scm') 213 parser.error('Couldn\'t determine the scm')
211 214
212 # TODO(maruel): HACK, remove me. 215 # TODO(maruel): HACK, remove me.
213 # When run a build slave, make sure buildbot knows that the checkout was 216 # When run a build slave, make sure buildbot knows that the checkout was
214 # modified. 217 # modified.
215 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot': 218 if options.root_dir == 'src' and getpass.getuser() == 'chrome-bot':
216 # See sourcedirIsPatched() in: 219 # See sourcedirIsPatched() in:
217 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/ 220 # http://src.chromium.org/viewvc/chrome/trunk/tools/build/scripts/slave/
218 # chromium_commands.py?view=markup 221 # chromium_commands.py?view=markup
219 open('.buildbot-patched', 'w').close() 222 open('.buildbot-patched', 'w').close()
220 223
221 print('\nApplying the patch.') 224 print('\nApplying the patch.')
222 try: 225 try:
223 scm_obj.apply_patch(patchset, verbose=True) 226 scm_obj.apply_patch(
227 patchset, verbose=True,
228 email=properties.get('owner_email', 'chrome-bot@chromium.org'),
229 name=properties.get('owner', 'chrome-bot'))
224 except checkout.PatchApplicationFailed, e: 230 except checkout.PatchApplicationFailed, e:
225 print(str(e)) 231 print(str(e))
226 print('CWD=%s' % os.getcwd()) 232 print('CWD=%s' % os.getcwd())
227 print('Checkout path=%s' % scm_obj.project_path) 233 print('Checkout path=%s' % scm_obj.project_path)
228 return 1 234 return 1
229 235
230 if ('DEPS' in map(os.path.basename, patchset.filenames) 236 if ('DEPS' in map(os.path.basename, patchset.filenames)
231 and not options.ignore_deps): 237 and not options.ignore_deps):
232 gclient_root = gclient_utils.FindGclientRoot(full_dir) 238 gclient_root = gclient_utils.FindGclientRoot(full_dir)
233 if gclient_root and scm_type: 239 if gclient_root and scm_type:
(...skipping 21 matching lines...) Expand all
255 f, options.revision_mapping) 261 f, options.revision_mapping)
256 annotated_gclient.emit_buildprops(revisions) 262 annotated_gclient.emit_buildprops(revisions)
257 263
258 return retcode 264 return retcode
259 return 0 265 return 0
260 266
261 267
262 if __name__ == "__main__": 268 if __name__ == "__main__":
263 fix_encoding.fix_encoding() 269 fix_encoding.fix_encoding()
264 sys.exit(main()) 270 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