This is a little bit more boiler plate, but the UX is much nicer.
Asserts produce race tracebacks while parser.error produces a clean
error message. This in turn makes it much more obvious that the
user made an error vs the tool crashing.
If gerrit_client was written using argparse, we could just set
required=True on the option, but it's still using optparse, and
that has no built-in support for required options.
Before:
$ ./gerrit_client.py addmessage
Traceback (most recent call last):
File ".../depot_tools/./gerrit_client.py", line 563, in <module>
sys.exit(main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 555, in main
return dispatcher.execute(OptionParser(), argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/subcommand.py", line 254, in execute
return command(parser, args[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 409, in CMDaddMessage
(opt, args) = parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 547, in parse_args
assert options.host, "--host not defined."
^^^^^^^^^^^^
AssertionError: --host not defined.
After:
$ ./gerrit_client.py addmessage
Usage: gerrit_client.py addMessage [options] [args ...]
gerrit_client.py: error: --host is required.
Change-Id: I2f807628439e6399daaedc00cd42d160505ee4ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172484
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
|
1 year ago | |
|---|---|---|
| bootstrap | 1 year ago | |
| fetch_configs | 1 year ago | |
| hooks | 2 years ago | |
| infra | 1 year ago | |
| infra_lib/telemetry | 1 year ago | |
| man | 1 year ago | |
| metadata | 1 year ago | |
| python-bin | ||
| python2-bin | ||
| recipes | 1 year ago | |
| testing_support | 1 year ago | |
| tests | 1 year ago | |
| third_party | 1 year ago | |
| win_toolchain | 1 year ago | |
| zsh-goodies | ||
| .cipd_impl.ps1 | 1 year ago | |
| .flake8 | 2 years ago | |
| .git-blame-ignore-revs | 1 year ago | |
| .gitattributes | 1 year ago | |
| .gitignore | 1 year ago | |
| .isort.cfg | ||
| .style.yapf | 2 years ago | |
| .vpython3 | 1 year ago | |
| BUILD_OWNERS | ||
| CROS_OWNERS | ||
| DIR_METADATA | ||
| LICENSE | ||
| LUCI_OWNERS | 2 years ago | |
| OWNERS | 1 year ago | |
| PRESUBMIT.py | 1 year ago | |
| README.gclient.md | ||
| README.git-cl.md | ||
| README.md | 2 years ago | |
| RECLIENT_OWNERS | ||
| WATCHLISTS | 3 years ago | |
| android_build_server_helper.py | 1 year ago | |
| auth.py | 1 year ago | |
| autoninja | 1 year ago | |
| autoninja.bat | 1 year ago | |
| autoninja.py | 1 year ago | |
| bazel | 2 years ago | |
| bazel.py | 2 years ago | |
| bb | 1 year ago | |
| bb.bat | ||
| black | ||
| bootstrap_python3 | ||
| breakpad.py | 2 years ago | |
| build_telemetry | 2 years ago | |
| build_telemetry.bat | 2 years ago | |
| build_telemetry.py | 1 year ago | |
| cbuildbot | ||
| cipd | 1 year ago | |
| cipd.bat | ||
| cipd_bin_setup.bat | ||
| cipd_bin_setup.sh | 1 year ago | |
| cipd_client_version | 1 year ago | |
| cipd_client_version.digests | 1 year ago | |
| cipd_manifest.txt | 1 year ago | |
| cipd_manifest.versions | 1 year ago | |
| cipd_manifest_cros_python2.txt | 2 years ago | |
| cipd_manifest_cros_python2.versions | ||
| clang-format | ||
| clang-format.bat | ||
| clang_format.py | 2 years ago | |
| codereview.settings | ||
| compile_single_file | 2 years ago | |
| compile_single_file.bat | 2 years ago | |
| compile_single_file.py | 2 years ago | |
| cpplint.bat | ||
| cpplint.py | 1 year ago | |
| cpplint_chromium.py | 2 years ago | |
| cros | 1 year ago | |
| cros_python2.vpython | ||
| cros_sdk | ||
| detect_host_arch.py | 2 years ago | |
| dirmd | 1 year ago | |
| dirmd.bat | ||
| download_from_google_storage | ||
| download_from_google_storage.bat | ||
| download_from_google_storage.py | 1 year ago | |
| ensure_bootstrap | 1 year ago | |
| fetch | ||
| fetch.bat | ||
| fetch.py | 2 years ago | |
| gclient | ||
| gclient-new-workdir.py | 2 years ago | |
| gclient.bat | ||
| gclient.py | 1 year ago | |
| gclient_completion.sh | ||
| gclient_eval.py | 1 year ago | |
| gclient_paths.py | 2 years ago | |
| gclient_scm.py | 1 year ago | |
| gclient_utils.py | 1 year ago | |
| gerrit | ||
| gerrit_client.py | 1 year ago | |
| gerrit_util.py | 1 year ago | |
| git-cache | ||
| git-cl | ||
| git-credential-luci | 1 year ago | |
| git-credential-luci.bat | 2 years ago | |
| git-crrev-parse | ||
| git-drover | ||
| git-find-releases | ||
| git-footers | ||
| git-freeze | ||
| git-gs | 2 years ago | |
| git-hyper-blame | ||
| git-map | ||
| git-map-branches | ||
| git-mark-merge-base | ||
| git-nav-downstream | ||
| git-nav-upstream | 2 years ago | |
| git-new-branch | ||
| git-number | ||
| git-rebase-update | ||
| git-rename-branch | ||
| git-reparent-branch | ||
| git-retry | ||
| git-runhooks | ||
| git-squash-branch | ||
| git-squash-branch-tree | 2 years ago | |
| git-thaw | ||
| git-upstream-diff | ||
| git_auth.py | 1 year ago | |
| git_cache.py | 2 years ago | |
| git_cl.py | 1 year ago | |
| git_cl_completion.sh | ||
| git_common.py | 1 year ago | |
| git_completion.sh | 2 years ago | |
| git_dates.py | 2 years ago | |
| git_find_releases.py | 2 years ago | |
| git_footers.py | 1 year ago | |
| git_freezer.py | 2 years ago | |
| git_hyper_blame.py | 1 year ago | |
| git_map.py | 2 years ago | |
| git_map_branches.py | 2 years ago | |
| git_mark_merge_base.py | 2 years ago | |
| git_nav_downstream.py | 2 years ago | |
| git_new_branch.py | 1 year ago | |
| git_number.py | 1 year ago | |
| git_rebase_update.py | 1 year ago | |
| git_rename_branch.py | 2 years ago | |
| git_reparent_branch.py | 2 years ago | |
| git_retry.py | 2 years ago | |
| git_squash_branch.py | 2 years ago | |
| git_squash_branch_tree.py | 2 years ago | |
| git_upstream_diff.py | 2 years ago | |
| gn | ||
| gn.bat | ||
| gn.py | 2 years ago | |
| gn_helper.py | 1 year ago | |
| google-java-format | 2 years ago | |
| google-java-format.bat | 2 years ago | |
| google_java_format.py | 2 years ago | |
| gsutil.py | 2 years ago | |
| gsutil.py.bat | ||
| gsutil.vpython3 | ||
| isort | 2 years ago | |
| led | 1 year ago | |
| led.bat | ||
| lockfile.py | 2 years ago | |
| luci-auth | 1 year ago | |
| luci-auth.bat | ||
| lucicfg | 1 year ago | |
| lucicfg.bat | ||
| mac_toolchain | 1 year ago | |
| metrics-xml-format | 1 year ago | |
| metrics.README.md | 1 year ago | |
| metrics.py | 1 year ago | |
| metrics_utils.py | 1 year ago | |
| metrics_xml_format.py | 1 year ago | |
| my_activity.py | 1 year ago | |
| newauth.py | 2 years ago | |
| ninja | ||
| ninja.bat | ||
| ninja.py | 2 years ago | |
| ninjalog_uploader.py | 1 year ago | |
| owners_client.py | 2 years ago | |
| owners_finder.py | 2 years ago | |
| pinpoint | 1 year ago | |
| pinpoint.bat | ||
| post_build_ninja_summary.py | 2 years ago | |
| presubmit_canned_checks.py | 1 year ago | |
| presubmit_diff.py | 1 year ago | |
| presubmit_support.py | 1 year ago | |
| prpc | 1 year ago | |
| prpc.bat | ||
| pylint-2.6 | 2 years ago | |
| pylint-2.6.bat | ||
| pylint-2.7 | 2 years ago | |
| pylint-2.7.bat | ||
| pylint-2.17 | 2 years ago | |
| pylint-2.17.bat | 2 years ago | |
| pylint-3.2 | 1 year ago | |
| pylint-3.2.bat | 1 year ago | |
| pylint_main.py | 1 year ago | |
| pylintrc-2.6 | 1 year ago | |
| pylintrc-2.7 | 1 year ago | |
| pylintrc-2.17 | 1 year ago | |
| pylintrc-3.2 | 1 year ago | |
| python_runner.sh | ||
| rdb | 1 year ago | |
| rdb.bat | ||
| rdb_wrapper.py | 2 years ago | |
| reclient_helper.py | 1 year ago | |
| reclientreport | ||
| reclientreport.bat | 3 years ago | |
| reclientreport.py | 2 years ago | |
| repo | 2 years ago | |
| repo_launcher | 1 year ago | |
| roll-dep | ||
| roll-dep.bat | ||
| roll_dep.py | 2 years ago | |
| roll_downstream_gcs_deps.py | 1 year ago | |
| rustfmt.py | 2 years ago | |
| scm.py | 1 year ago | |
| setup_color.py | 2 years ago | |
| siso | ||
| siso.bat | ||
| siso.py | 1 year ago | |
| split_cl.py | 1 year ago | |
| subcommand.py | 2 years ago | |
| subprocess2.py | 2 years ago | |
| swift-format | ||
| swift_format.py | 2 years ago | |
| update_depot_tools | 1 year ago | |
| update_depot_tools.bat | 2 years ago | |
| update_depot_tools_toggle.py | 2 years ago | |
| upload_metrics.py | 2 years ago | |
| upload_to_google_storage.py | 1 year ago | |
| upload_to_google_storage_first_class.py | 2 years ago | |
| utils.py | 2 years ago | |
| vpython3 | 1 year ago | |
| vpython3.bat | ||
| watchlists.py | 2 years ago | |
| whitespace.txt | ||
| win32imports.py | 2 years ago | |
| yapf | 2 years ago | |
| yapf.bat | ||
README.md
depot_tools
Tools for working with Chromium development. It requires python 3.8.
Tools
The most important tools are:
fetch: Agclientwrapper to checkout a project. Usefetch --helpfor more details.gclient: A meta-checkout tool. Think repo or git submodules, except that it support OS-specific rules, e.g. do not checkout Windows only dependencies when checking out for Android. Usegclient helpfor more details and README.gclient.md.git cl: A code review tool to interact with Rietveld or Gerrit. Usegit cl helpfor more details and README.git-cl.md.roll-dep: A gclient dependency management tool to submit a dep roll, updating a dependency to a newer revision.
There are a lot of git utilities included.
Updating
depot_tools updates itself automatically when running gclient tool. To
disable auto update, set the environment variable DEPOT_TOOLS_UPDATE=0 or
run ./update_depot_tools_toggle.py --disable.
To update package manually, run update_depot_tools.bat on Windows,
or ./update_depot_tools on Linux or Mac.
On Windows only, running gclient will install git and python.
Contributing
To contribute change for review:
git new-branch <somename>
# Hack
git add .
git commit -a -m "Fixes goat teleporting"
# find reviewers
git cl owners
git log -- <yourfiles>
# Request a review.
git cl upload -r reviewer1@chromium.org,reviewer2@chromium.org --send-mail
# Edit change description if needed.
git cl desc
# If change is approved, flag it to be committed.
git cl set-commit
# If change needs more work.
git rebase-update
...
git cl upload -t "Fixes goat teleporter destination to be Australia"
See also open bugs, open reviews, forum or report problems.
cpplint.py
Until 2018, our cpplint.py was a copy of the upstream version at
https://github.com/google/styleguide/tree/gh-pages/cpplint. Unfortunately, that
repository is not maintained any more.
If you want to update cpplint.py in depot_tools, just upload a patch to do
so. We will figure out a long-term strategy via issue https://crbug.com/916550.
Note that the cpplint.py here is also used by the Tricium
analyzer,
so if the cpplint.py here changes, we should also update the copy used there.