15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# Copyright (C) 2010 Google Inc. All rights reserved.
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# Redistribution and use in source and binary forms, with or without
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# modification, are permitted provided that the following conditions are
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# met:
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#     * Redistributions of source code must retain the above copyright
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# notice, this list of conditions and the following disclaimer.
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#     * Redistributions in binary form must reproduce the above
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# copyright notice, this list of conditions and the following disclaimer
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# in the documentation and/or other materials provided with the
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# distribution.
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#     * Neither the name of Google Inc. nor the names of its
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# contributors may be used to endorse or promote products derived from
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# this software without specific prior written permission.
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)from optparse import make_option
305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class Options(object):
325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    blocks = make_option("--blocks", action="store", type="string", dest="blocks", default=None, help="Bug number which the created bug blocks.")
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    build = make_option("--build", action="store_true", dest="build", default=False, help="Build and run run-webkit-tests before committing.")
345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    build_style = make_option("--build-style", action="store", dest="build_style", default=None, help="Whether to build debug, release, or both.")
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    cc = make_option("--cc", action="store", type="string", dest="cc", help="Comma-separated list of email addresses to carbon-copy.")
365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    check_style = make_option("--ignore-style", action="store_false", dest="check_style", default=True, help="Don't check to see if the patch has proper style before uploading.")
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    check_style_filter = make_option("--check-style-filter", action="store", type="string", dest="check_style_filter", default=None, help="Filter style-checker rules (see check-webkit-style --help).")
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    clean = make_option("--no-clean", action="store_false", dest="clean", default=True, help="Don't check if the working directory is clean before applying patches")
395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    close_bug = make_option("--no-close", action="store_false", dest="close_bug", default=True, help="Leave bug open after landing.")
405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    comment = make_option("--comment", action="store", type="string", dest="comment", help="Comment to post to bug.")
415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    component = make_option("--component", action="store", type="string", dest="component", help="Component for the new bug.")
425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    confirm = make_option("--no-confirm", action="store_false", dest="confirm", default=True, help="Skip confirmation steps.")
435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    description = make_option("-m", "--description", action="store", type="string", dest="description", help="Description string for the attachment")
445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    email = make_option("--email", action="store", type="string", dest="email", help="Email address to use in ChangeLogs.")
455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    force_clean = make_option("--force-clean", action="store_true", dest="force_clean", default=False, help="Clean working directory before applying patches (removes local changes and commits)")
465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    git_commit = make_option("-g", "--git-commit", action="store", dest="git_commit", help="Operate on a local commit. If a range, the commits are squashed into one. <ref>.... includes the working copy changes. UPSTREAM can be used for the upstream/tracking branch.")
475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    local_commit = make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch")
485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    non_interactive = make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible.")
495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    obsolete_patches = make_option("--no-obsolete", action="store_false", dest="obsolete_patches", default=True, help="Do not obsolete old patches before posting this one.")
505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    open_bug = make_option("--open-bug", action="store_true", dest="open_bug", default=False, help="Opens the associated bug in a browser.")
515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.")
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    quiet = make_option("--quiet", action="store_true", dest="quiet", default=False, help="Produce less console output.")
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    request_commit = make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review.")
545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    review = make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review.")
555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    reviewer = make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER.")
565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    suggest_reviewers = make_option("--suggest-reviewers", action="store_true", default=False, help="Offer to CC appropriate reviewers.")
575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    test = make_option("--test", action="store_true", dest="test", default=False, help="Run run-webkit-tests before committing.")
585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    update = make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory.")
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    update_changelogs = make_option("--update-changelogs", action="store_true", dest="update_changelogs", default=False, help="Update existing ChangeLog entries with new date, bug description, and touched files/functions.")
605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)    changelog_count = make_option("--changelog-count", action="store", type="int", dest="changelog_count", help="Number of changelogs to parse.")
61