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

Side by Side Diff: trychange.py

Issue 536002: Add --webkit option as a shorthand for -s third_party/WebKit. (Closed)
Patch Set: Created 10 years, 11 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 | « git-try ('k') | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 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 """Client-side script to send a try job to the try server. It communicates to 5 """Client-side script to send a try job to the try server. It communicates to
6 the try server by either writting to a svn repository or by directly connecting 6 the try server by either writting to a svn repository or by directly connecting
7 to the server by HTTP. 7 to the server by HTTP.
8 """ 8 """
9 9
10 import datetime 10 import datetime
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 url = 'http://%s:%s/send_try_patch' % (options.host, options.port) 257 url = 'http://%s:%s/send_try_patch' % (options.host, options.port)
258 proxies = None 258 proxies = None
259 if options.proxy: 259 if options.proxy:
260 if options.proxy.lower() == 'none': 260 if options.proxy.lower() == 'none':
261 # Effectively disable HTTP_PROXY or Internet settings proxy setup. 261 # Effectively disable HTTP_PROXY or Internet settings proxy setup.
262 proxies = {} 262 proxies = {}
263 else: 263 else:
264 proxies = {'http': options.proxy, 'https': options.proxy} 264 proxies = {'http': options.proxy, 'https': options.proxy}
265 265
266 logging.warning('Sending by HTTP') 266 logging.info('Sending by HTTP')
267 logging.info(description) 267 logging.info(description)
268 logging.info(url) 268 logging.info(url)
269 logging.info(options.diff) 269 logging.info(options.diff)
270 if options.dry_run: 270 if options.dry_run:
271 return 271 return
272 272
273 try: 273 try:
274 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies) 274 connection = urllib.urlopen(url, urllib.urlencode(values), proxies=proxies)
275 except IOError, e: 275 except IOError, e:
276 logging.warning(str(e)) 276 logging.warning(str(e))
(...skipping 12 matching lines...) Expand all
289 289
290 def _SendChangeSVN(options): 290 def _SendChangeSVN(options):
291 """Send a change to the try server by committing a diff file on a subversion 291 """Send a change to the try server by committing a diff file on a subversion
292 server.""" 292 server."""
293 if not options.svn_repo: 293 if not options.svn_repo:
294 raise NoTryServerAccess('Please use the --svn_repo option to specify the' 294 raise NoTryServerAccess('Please use the --svn_repo option to specify the'
295 ' try server svn repository to connect to.') 295 ' try server svn repository to connect to.')
296 296
297 values = _ParseSendChangeOptions(options) 297 values = _ParseSendChangeOptions(options)
298 description = ''.join("%s=%s\n" % (k,v) for (k,v) in values.iteritems()) 298 description = ''.join("%s=%s\n" % (k,v) for (k,v) in values.iteritems())
299 logging.warning('Sending by SVN') 299 logging.info('Sending by SVN')
300 logging.info(description) 300 logging.info(description)
301 logging.info(options.svn_repo) 301 logging.info(options.svn_repo)
302 logging.info(options.diff) 302 logging.info(options.diff)
303 if options.dry_run: 303 if options.dry_run:
304 return 304 return
305 305
306 # Do an empty checkout. 306 # Do an empty checkout.
307 temp_dir = tempfile.mkdtemp() 307 temp_dir = tempfile.mkdtemp()
308 temp_file = tempfile.NamedTemporaryFile() 308 temp_file = tempfile.NamedTemporaryFile()
309 try: 309 try:
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 group.add_option("--root", 467 group.add_option("--root",
468 help="Root to use for the patch; base subdirectory for " 468 help="Root to use for the patch; base subdirectory for "
469 "patch created in a subdirectory") 469 "patch created in a subdirectory")
470 group.add_option("-p", "--patchlevel", type='int', metavar="LEVEL", 470 group.add_option("-p", "--patchlevel", type='int', metavar="LEVEL",
471 help="Used as -pN parameter to patch") 471 help="Used as -pN parameter to patch")
472 group.add_option("-s", "--sub_rep", action="append", default=[], 472 group.add_option("-s", "--sub_rep", action="append", default=[],
473 help="Subcheckout to use in addition. This is mainly " 473 help="Subcheckout to use in addition. This is mainly "
474 "useful for gclient-style checkouts. Use @rev or " 474 "useful for gclient-style checkouts. Use @rev or "
475 "@branch or @branch1..branch2 to specify the " 475 "@branch or @branch1..branch2 to specify the "
476 "revision/branch to diff against.") 476 "revision/branch to diff against.")
477 # Mostly chromium-specific
478 group.add_option("--webkit", action="append_const",
479 const="third_party/WebKit",
480 dest="sub_rep",
481 help="Shorthand for -s third_party/WebKit")
477 group.add_option("--no_gclient", action="store_true", 482 group.add_option("--no_gclient", action="store_true",
478 help="Disable automatic search for gclient checkout.") 483 help="Disable automatic search for gclient checkout.")
479 parser.add_option_group(group) 484 parser.add_option_group(group)
480 485
481 group = optparse.OptionGroup(parser, "Access the try server by HTTP") 486 group = optparse.OptionGroup(parser, "Access the try server by HTTP")
482 group.add_option("--use_http", 487 group.add_option("--use_http",
483 action="store_const", 488 action="store_const",
484 const=_SendChangeHTTP, 489 const=_SendChangeHTTP,
485 dest="send_patch", 490 dest="send_patch",
486 help="Use HTTP to talk to the try server [default]") 491 help="Use HTTP to talk to the try server [default]")
(...skipping 24 matching lines...) Expand all
511 if not swallow_exception: 516 if not swallow_exception:
512 if options.verbose == 0: 517 if options.verbose == 0:
513 logging.basicConfig(level=logging.ERROR) 518 logging.basicConfig(level=logging.ERROR)
514 elif options.verbose == 1: 519 elif options.verbose == 1:
515 logging.basicConfig(level=logging.WARNING) 520 logging.basicConfig(level=logging.WARNING)
516 elif options.verbose == 2: 521 elif options.verbose == 2:
517 logging.basicConfig(level=logging.INFO) 522 logging.basicConfig(level=logging.INFO)
518 elif options.verbose > 2: 523 elif options.verbose > 2:
519 logging.basicConfig(level=logging.DEBUG) 524 logging.basicConfig(level=logging.DEBUG)
520 525
526 logging.debug(argv)
527
521 try: 528 try:
522 # Always include os.getcwd() in the checkout settings. 529 # Always include os.getcwd() in the checkout settings.
523 checkouts = [] 530 checkouts = []
524 checkouts.append(GuessVCS(options, os.getcwd())) 531 checkouts.append(GuessVCS(options, os.getcwd()))
525 checkouts[0].AutomagicalSettings() 532 checkouts[0].AutomagicalSettings()
526 for item in options.sub_rep: 533 for item in options.sub_rep:
527 checkout = GuessVCS(options, os.path.join(checkouts[0].checkout_root, 534 checkout = GuessVCS(options, os.path.join(checkouts[0].checkout_root,
528 item)) 535 item))
529 if checkout.checkout_root in [c.checkout_root for c in checkouts]: 536 if checkout.checkout_root in [c.checkout_root for c in checkouts]:
530 parser.error('Specified the root %s two times.' % 537 parser.error('Specified the root %s two times.' %
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 except (InvalidScript, NoTryServerAccess), e: 618 except (InvalidScript, NoTryServerAccess), e:
612 if swallow_exception: 619 if swallow_exception:
613 return 1 620 return 1
614 print e 621 print e
615 return 1 622 return 1
616 return 0 623 return 0
617 624
618 625
619 if __name__ == "__main__": 626 if __name__ == "__main__":
620 sys.exit(TryChange(None, [], False)) 627 sys.exit(TryChange(None, [], False))
OLDNEW
« no previous file with comments | « git-try ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698