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

Side by Side Diff: trychange.py

Issue 228113003: Refactoring in trychange: _ParseSendChangeOptions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 8 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 | 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/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 """Client-side script to send a try job to the try server. It communicates to 6 """Client-side script to send a try job to the try server. It communicates to
7 the try server by either writting to a svn/git repository or by directly 7 the try server by either writting to a svn/git repository or by directly
8 connecting to the server by HTTP. 8 connecting to the server by HTTP.
9 """ 9 """
10 10
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 pass 414 pass
415 415
416 return bot_spec 416 return bot_spec
417 417
418 418
419 def _ParseSendChangeOptions(bot_spec, options): 419 def _ParseSendChangeOptions(bot_spec, options):
420 """Parse common options passed to _SendChangeHTTP, _SendChangeSVN and 420 """Parse common options passed to _SendChangeHTTP, _SendChangeSVN and
421 _SendChangeGit. 421 _SendChangeGit.
422 """ 422 """
423 values = [ 423 values = [
424 ('user', options.user), 424 ('user', options.user),
425 ('name', options.name), 425 ('name', options.name),
426 ] 426 ]
427 if options.email: 427 # A list of options to copy.
428 values.append(('email', options.email)) 428 optional_values = (
429 if options.revision: 429 'email',
430 values.append(('revision', options.revision)) 430 'revision',
431 'root',
432 'patchlevel',
433 'issue',
434 'patchset',
435 'target',
436 'project',
437 )
438 for option_name in optional_values:
439 value = getattr(options, option_name)
440 if value:
441 values.append((option_name, value))
442
443 # Not putting clobber to optional_names
444 # because it used to have lower-case 'true'.
431 if options.clobber: 445 if options.clobber:
432 values.append(('clobber', 'true')) 446 values.append(('clobber', 'true'))
433 if options.root:
434 values.append(('root', options.root))
435 if options.patchlevel:
436 values.append(('patchlevel', options.patchlevel))
437 if options.issue:
438 values.append(('issue', options.issue))
439 if options.patchset:
440 values.append(('patchset', options.patchset))
441 if options.target:
442 values.append(('target', options.target))
443 if options.project:
444 values.append(('project', options.project))
445 447
446 for bot, tests in bot_spec: 448 for bot, tests in bot_spec:
447 values.append(('bot', ('%s:%s' % (bot, ','.join(tests))))) 449 values.append(('bot', ('%s:%s' % (bot, ','.join(tests)))))
448 450
449 return values 451 return values
450 452
451 453
452 def _SendChangeHTTP(bot_spec, options): 454 def _SendChangeHTTP(bot_spec, options):
453 """Send a change to the try server using the HTTP protocol.""" 455 """Send a change to the try server using the HTTP protocol."""
454 if not options.host: 456 if not options.host:
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 return 1 1120 return 1
1119 except (gclient_utils.Error, subprocess2.CalledProcessError), e: 1121 except (gclient_utils.Error, subprocess2.CalledProcessError), e:
1120 print >> sys.stderr, e 1122 print >> sys.stderr, e
1121 return 1 1123 return 1
1122 return 0 1124 return 0
1123 1125
1124 1126
1125 if __name__ == "__main__": 1127 if __name__ == "__main__":
1126 fix_encoding.fix_encoding() 1128 fix_encoding.fix_encoding()
1127 sys.exit(TryChange(None, None, False)) 1129 sys.exit(TryChange(None, None, False))
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