Historically, git_cl.py and presubmit_support.py generated diffs inconsistently. ==== git_cl.py ==== 1) git_cl.py:_RunClangFormatDiff() assumed the input diff was generated with --no-prefix. Therefore, it hard-coded -p0 as a param for clang_format_diff.py. If the diff was generated without --no-prefix, it would have to pass -p1 instead. 2) git_cl.py _RunYapf() and _RunGoogleJavaFormat assumed that the input diff was generated with prefixes. Therefore, it parsed the diffs, assuming that the diff was generated with a/ and b/ prefixes. This discrepancy wasn't an issue because each of the Run functions generated and consumed the diffs within themselves. It became an issue when https://crrev.com/c/6931775 was developed. The CL consolidated the diff generation into a common function, so that all _Run functions need to agree with the presence of the prefixes. The CL changed _RunClangFormatDiff() to use -p1 instead of -p0, mainly because - it's the p level for the default git-diff option - it's the p level for the unix diff util - CiderG Chromium also generates the diff with the prefixes to emulate the default diff output. - I highly believe that --no-prefix was chosen for no reasons. It seems to be a random choice to work with -p0. - Either Java/Python or Clang wrapper should be changed. ==== presubmit_support.py ==== presubmit_support.py can be given a diff_file via --diff_file. Otherwise, it generates the diff based on --upstream_commit. a) it doesn't enforce the presence of the prefixes in the input diff_file. As stated above, the Chromium extension generates a diff with prefixes. b) in contrast, when it is not given --diff_file, it generates the diff with --no-prefix, and I don't find any reasons for it. I believe that it's from a copy-pasted random choice. ==== the problem ==== This discarepancy became a problem, when crrev.com/c/6937365 was landed. It enforces git_cl.py and presubmit_support.py to agree for the format of the input diff. That is, the presence of the prefixes must be agreed by all the following. - presubmit_support.py with --diff_file /tmp/abc - presubmit_suppory.py without --diff_file /tmp/abc - git cl format - git cl format --input_diff_file /tmp/abc ==== possible solutions ==== Obviously, there are 3 choices. 1) update the regex and parsers of git_cl.py to auto detect the best -p{num}. This was the least preferred option, as it can be fragile. 2) update Chromium extension and git_cl.py to use --no-prefix. i.e., - update the Chromium CiderG to generate diffs without the prefix. - update the regex used in _ComputeFormatDiffLineRanges() to assume that the input is generated with --no-prefix. - change _RunClangFormatDiff() to pass -p0 instead of -p1. 3) update presubmit_support.py to generate diff without --no-prefix. ==== What this CL does ==== It implements (3). - That is the default option for git-diff. - I don't find obvious reasons to use --no-prefix. - CiderG has been generating diffs with prefixes for weeks. - It implies that presubmit_support.py works fine with a prefixed diff. Bug: 386840832 Change-Id: Iac8a4fc30f101e70e3ccc56f9f8ee48198dfa833 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6939737 Commit-Queue: Scott Lee <ddoman@chromium.org> Reviewed-by: Gavin Mak <gavinmak@google.com> |
2 months ago | |
|---|---|---|
| bootstrap | 9 months ago | |
| fetch_configs | 4 months ago | |
| hooks | 2 years ago | |
| infra | 2 months ago | |
| infra_lib/telemetry | 4 months ago | |
| man | 3 months ago | |
| mcp | 2 months ago | |
| metadata | 2 months ago | |
| python-bin | 6 months ago | |
| python2-bin | 3 years ago | |
| recipes | 2 months ago | |
| testing_support | 9 months ago | |
| tests | 2 months ago | |
| third_party | 9 months ago | |
| win_toolchain | 4 months ago | |
| zsh-goodies | ||
| .cipd_impl.ps1 | 11 months ago | |
| .flake8 | 2 years ago | |
| .git-blame-ignore-revs | 1 year ago | |
| .gitattributes | 6 months ago | |
| .gitignore | 1 year ago | |
| .isort.cfg | ||
| .style.yapf | 2 years ago | |
| .vpython3 | 3 months ago | |
| BUILD_OWNERS | 3 years ago | |
| CROS_OWNERS | ||
| DIR_METADATA | 2 months ago | |
| LICENSE | ||
| LUCI_OWNERS | 2 years ago | |
| OWNERS | 3 months ago | |
| PRESUBMIT.py | 3 months ago | |
| README.gclient.md | ||
| README.git-cl.md | ||
| README.google_cloud_storage.md | 8 months ago | |
| README.md | 6 months ago | |
| RECLIENT_OWNERS | 3 years ago | |
| WATCHLISTS | 2 years ago | |
| android_build_server_helper.py | 6 months ago | |
| auth.py | 2 months ago | |
| autoninja | 8 months ago | |
| autoninja.bat | 1 year ago | |
| autoninja.py | 2 months ago | |
| bazel | 2 years ago | |
| bazel.py | 2 years ago | |
| bb | 1 year ago | |
| bb.bat | ||
| black | ||
| bootstrap_python3 | 3 years ago | |
| breakpad.py | 2 years ago | |
| build_telemetry | 1 year ago | |
| build_telemetry.bat | 1 year ago | |
| build_telemetry.py | 1 year ago | |
| caffeinate.py | 5 months ago | |
| cbuildbot | ||
| cipd | 4 months ago | |
| cipd.bat | 4 months ago | |
| cipd_bin_setup.bat | ||
| cipd_bin_setup.sh | 5 months ago | |
| cipd_client_version | 1 year ago | |
| cipd_client_version.digests | 1 year ago | |
| cipd_manifest.txt | 2 months ago | |
| cipd_manifest.versions | 2 months ago | |
| cipd_manifest_cros_python2.txt | 2 years ago | |
| cipd_manifest_cros_python2.versions | 3 years ago | |
| clang-format | ||
| clang-format.bat | ||
| clang_format.py | 3 months 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 | 7 months ago | |
| cpplint_chromium.py | 2 years ago | |
| create_temp_file.py | 3 months ago | |
| cros | 10 months ago | |
| cros_python2.vpython | 3 years ago | |
| cros_sdk | ||
| detect_host_arch.py | 4 months ago | |
| dirmd | 1 year ago | |
| dirmd.bat | ||
| download_from_google_storage | ||
| download_from_google_storage.bat | ||
| download_from_google_storage.py | 7 months ago | |
| ensure_bootstrap | 10 months ago | |
| fetch | 3 years ago | |
| fetch.bat | 3 years ago | |
| fetch.py | 1 year ago | |
| gclient | 3 years ago | |
| gclient-new-workdir.py | 1 year ago | |
| gclient.bat | 3 years ago | |
| gclient.py | 3 months ago | |
| gclient_completion.sh | ||
| gclient_eval.py | 1 year ago | |
| gclient_paths.py | 2 months ago | |
| gclient_scm.py | 7 months ago | |
| gclient_utils.py | 7 months ago | |
| gerrit | 3 years ago | |
| gerrit_client.py | 4 months ago | |
| gerrit_util.py | 4 months ago | |
| git-cache | ||
| git-cl | ||
| git-credential-luci | 7 months ago | |
| git-credential-luci.bat | 1 year 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 | 1 year ago | |
| git-thaw | ||
| git-upstream-diff | ||
| git_auth.py | 3 months ago | |
| git_cache.py | 5 months ago | |
| git_cl.py | 2 months ago | |
| git_cl_completion.sh | ||
| git_common.py | 7 months ago | |
| git_completion.sh | 2 years ago | |
| git_dates.py | 2 years ago | |
| git_find_releases.py | 2 years ago | |
| git_footers.py | 11 months ago | |
| git_freezer.py | 2 years ago | |
| git_hyper_blame.py | 1 year ago | |
| git_map.py | 2 years ago | |
| git_map_branches.py | 8 months 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 | 9 months 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 | 9 months ago | |
| git_squash_branch_tree.py | 9 months ago | |
| git_upstream_diff.py | 2 years ago | |
| gn | 6 months ago | |
| gn.bat | 6 months ago | |
| gn.py | 3 months ago | |
| gn_helper.py | 9 months ago | |
| google-java-format | 2 years ago | |
| google-java-format.bat | 2 years ago | |
| google_java_format.py | 1 year ago | |
| gsutil.py | 7 months ago | |
| gsutil.py.bat | ||
| gsutil.vpython3 | ||
| isort | 2 years ago | |
| led | 1 year ago | |
| led.bat | ||
| lockfile.py | 6 months ago | |
| luci-auth | 1 year ago | |
| luci-auth-fido2-plugin | 3 months ago | |
| luci-auth-fido2-plugin.bat | 3 months ago | |
| luci-auth-ssh-helper | 3 months ago | |
| luci-auth-ssh-helper.bat | 3 months ago | |
| luci-auth-ssh-plugin | 3 months ago | |
| luci-auth-ssh-plugin.bat | 3 months ago | |
| luci-auth.bat | ||
| luci_auth_fido2_plugin.py | 3 months ago | |
| lucicfg | 1 year ago | |
| lucicfg.bat | ||
| mac_toolchain | 1 year ago | |
| metrics-xml-format | 11 months ago | |
| metrics.README.md | 1 year ago | |
| metrics.py | 1 year ago | |
| metrics_utils.py | 1 year ago | |
| metrics_xml_format.py | 4 months ago | |
| my_activity.py | 11 months ago | |
| newauth.py | 7 months ago | |
| ninja | 3 years ago | |
| ninja.bat | 3 years ago | |
| ninja.py | 2 months ago | |
| ninjalog_uploader.py | 6 months ago | |
| owners_client.py | 8 months ago | |
| owners_finder.py | 2 years ago | |
| pinpoint | 1 year ago | |
| pinpoint.bat | ||
| post_build_ninja_summary.py | 9 months ago | |
| presubmit_canned_checks.py | 2 months ago | |
| presubmit_diff.py | 10 months ago | |
| presubmit_support.py | 2 months 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 | 10 months ago | |
| pylint-3.2.bat | 10 months ago | |
| pylint_main.py | 10 months ago | |
| pylintrc-2.6 | 10 months ago | |
| pylintrc-2.7 | 10 months ago | |
| pylintrc-2.17 | 10 months ago | |
| pylintrc-3.2 | 10 months ago | |
| python_runner.sh | 3 years ago | |
| rdb | 1 year ago | |
| rdb.bat | ||
| rdb_wrapper.py | 2 years ago | |
| reclient_helper.py | 4 months ago | |
| reclientreport | 3 years ago | |
| reclientreport.bat | 2 years ago | |
| reclientreport.py | 2 years ago | |
| repo | 1 year ago | |
| repo_launcher | 3 months ago | |
| roll-dep | 3 years ago | |
| roll-dep.bat | 3 years ago | |
| roll_dep.py | 6 months ago | |
| roll_downstream_gcs_deps.py | 1 year ago | |
| rustfmt.py | 2 years ago | |
| scm.py | 2 months ago | |
| setup_color.py | 2 years ago | |
| siso | 8 months ago | |
| siso.bat | 8 months ago | |
| siso.py | 2 months ago | |
| split_cl.py | 6 months ago | |
| subcommand.py | 6 months ago | |
| subprocess2.py | 2 years ago | |
| swift-format | ||
| swift_format.py | 2 years ago | |
| update_depot_tools | 10 months ago | |
| update_depot_tools.bat | 9 months 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 | 1 year ago | |
| utils.py | 1 year 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.
Also, includes shell script/batch file for tools required to build chromium, e.g.
gn: a meta-build system that generates build files for Ninjaautoninja: a wrapper forsisoandninja.siso: a build tool that aims to significantly speed up Chromium's build.ninja: a small build system with a focus on speed. deprecated by Siso.
These shell script/batch file runs python script with python-bin/python3
that find binaries in chromium checkout, and run with proper setup/check.
To use these wrappers, you need to initialize/bootstrap depot_tools (using
gclient, update_depot_tools or ensure_bootstrap).
Installing
See set-up documentation.
depot_tools is also available in
-
chromium's third_party/depot_tools: propagated by autoroller.
-
on builder: infra_internal/recipe_bundles/chrome-internal.googlesource.com/chrome/tools/build bundles depot_tools. propagated by build_internal recipe roller
These depot_tools would not be initialized/bootstrapped (i.e. no
python-bin/python3 binary available), so the build tool wrapper won't work,
unless it is explicitly initialized by ensure_bootstrap.
Or, directly call the python script instead of using the shell script/batch
file.
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.
Running gclient will install python3 binary.
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.