Commit Graph

1204 Commits (55774b24e693cd2fbcded6bdd773ab8b4a9c1a84)

Author SHA1 Message Date
Will Harris 246580c7b8 Explicitly call vpython3 to launch the mojom formatter
Before this change, on Windows launching the .py file would open it
with the system default handler (none, or notepad.exe) instead of
launching it with python.

This CL fixes this issue. Tested manually on Linux and Windows and
seems to work on both OS.

BUG=332935377

Change-Id: I8ef348c59dd08a4b5c2099f04968622aaa0927d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5427704
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Will Harris <wfh@chromium.org>
1 year ago
Joanna Wang 8ce0983f79 Revert "Print presubmit command during git cl upload."
This reverts commit 913bda46ea.

Reason for revert: no longer needed

Original change's description:
> Print presubmit command during git cl upload.
>
> Bug: 329231688
> Change-Id: I45d0afbebf01ea1cba4d7fdf32843a8e11eb424c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5401481
> Auto-Submit: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Commit-Queue: Joanna Wang <jojwang@chromium.org>

Bug: 329231688
Change-Id: I588b0c1a588d663a170cfd218f5338af8e9d1080
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5413953
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Alex Rudenko b57ec522d0 Revert "git_cl: format .nc file with clang-format"
This reverts commit e545830db2.

Reason for revert: https://crbug.com/332481520

Original change's description:
> git_cl: format .nc file with clang-format
>
> This is for
> https://crrev.com/c/5197064/58/.clang-format#50
>
> Bug: 329138753
> Change-Id: I0938e1d610580e59a66409eb4fea4a1dad138bf1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5409735
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Takuto Ikuta <tikuta@chromium.org>

Bug: 329138753
Change-Id: I696eeb3b12540af86e7af0cddfa42f79b27f99f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5412633
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Alex Rudenko <alexrudenko@chromium.org>
1 year ago
Takuto Ikuta e545830db2 git_cl: format .nc file with clang-format
This is for
https://crrev.com/c/5197064/58/.clang-format#50

Bug: 329138753
Change-Id: I0938e1d610580e59a66409eb4fea4a1dad138bf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5409735
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
1 year ago
Joanna Wang 913bda46ea Print presubmit command during git cl upload.
Bug: 329231688
Change-Id: I45d0afbebf01ea1cba4d7fdf32843a8e11eb424c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5401481
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
1 year ago
Andrew Grieve 56581348a2 git cl format: Remove unused imports & excessive blank lines
google-java-format will only change the lines given by --lines, which
means that:
a) Unused imports are not removed (assuming they were existing imports)
b) Excessive blank lines between methods are not removed

To address this, run google-java-format a second time with
--fix-imports-only, include deleted lines in ranges, and expand ranges
by 2 lines on each side.

Bug: 1462204
Change-Id: Ia12af6def28d9fe11e8315a951d45908f7cee725
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5362198
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
1 year ago
Tomasz Śniatowski fe6a359a80 Fix git cl format --diff --dry-run for Java files
A recent change added --diff support for Java files in git cl format,
but unfortunately it broke the behavior when both --dry-run and --diff
are passed, and made git cl format indicate that all changed files need
to be reformatted.

Fix so that --diff overrides --dry-run when running google-java-format,
as passing --dry-run makes the formatter only output file names which
then confused the diff creation code. This makes behavior for Java in
line with C++ where --dry-run doesn't change much if --diff is used.

Change-Id: I7f8eecb13064a0046935489e6c5cf3af566f7f56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5357818
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Tomasz Śniatowski <tomasz.sniatowski@xperi.com>
1 year ago
Aleksey Khoroshilov 78bef266ac Display diff on `git cl format --diff` when formatting Java files.
Google Java Format does not support `--diff` parameter, but we can simulate it by manually diffing the output of the tool with the current
file on disk.

All git cl-triggered format tools should support --diff output, because there're situations where a change in a file might be required, but it's unclear what exactly should be changed, because a developer might not have access to the host OS which only runs the check.

We at Brave want to run `git cl format --diff` as a part of CI run when a format check fails.

Change-Id: I2feee60219a54ad44b93bc10f5488a9c05715a4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5351216
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aleksey Khoroshilov <akhoroshilov@brave.com>
1 year ago
mlcui de6a9a9692 git_cl: Add JSON output flag for `git cl presubmit`
This allows scripts to use `git cl presubmit` to get JSON output from
the presubmit hook.

See https://crrev.com/c/5302055/comment/5b78090c_24935055/ for more
context.

Bug: None
Change-Id: I5aaee016b74f8b7375eaf9c5d10cb0af8d86bad8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5320109
Commit-Queue: Michael Cui <mlcui@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
1 year ago
Eric Leese 875647ed03 Allow refs/branch-heads
This is necessary for uploading v8 changes.

Bug: None
Change-Id: I2847c4bcddacf1985c0c230b892716942ae2b031
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5332374
Auto-Submit: Eric Leese <leese@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Eric Leese <leese@chromium.org>
1 year ago
mlcui cc3373c0e4 git_cl: Fix Python type annotations for Pylance
Pylance does not like the ending bracket on its own line. As
`UploadAllSquashed` above uses inline type annotations, rewrite
`_UploadAllPrecheck`s type annotations inline as well.

Bug: None
Change-Id: I9b34cb4834530fffb9cb1788cd690f34d805f96f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5333896
Commit-Queue: Michael Cui <mlcui@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
1 year ago
Aravind Vasudevan af26c1dfaa [git-cl] Skip EnsureAuthenticated check for sso:// schemes
Bug: 40276698
Change-Id: I40414607a75287adcacee2ff47f8ba8db4c285c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5325207
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Gavin Mak b1b1a43f07 Move LSC check into pan project presubmit checks and check num files
git cl upload prompts a user if they upload a particularly large change,
determined by the number of CCs added on the change. With the watchlists
analyzer and eventual removal of CCing watchers from git cl, this check
needs to be updated to work without knowing the number of CCs.

This change does two things:
1. Moves the check from git cl upload to a pan-project presubmit check.
2. Update the heuristic of a LSC from > 100 CCs to > 100 files modified.

Bug: 324562917
Change-Id: I6bd0db9fde942273acebc320c8b52e81b02bd42f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5296199
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
1 year ago
Gavin Mak 32769fe939 Revert "Deprecate --bypass-watchlists flag"
This reverts commit e98e458a9f.

Reason for revert: keep depot_tools CCing watchers while b/324466185 is open

Original change's description:
> Deprecate --bypass-watchlists flag
>
> CCing watchers is now handled by the Watchlists AyeAye analyzer on
> all Gerrit projects that use it, and not CCing watchers locally has
> no effect. Rely on that instead of logic in git cl.
>
> Bug: 41494851, 40242793
> Change-Id: I58fdf8c0a741a9189cccec3b3b56d0a8a1c44058
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5276660
> Reviewed-by: Scott Lee <ddoman@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 41494851, 40242793
Change-Id: Ied75beb163b2628343d4dcac5819b5bd77854de8
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5281700
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
1 year ago
Gavin Mak e98e458a9f Deprecate --bypass-watchlists flag
CCing watchers is now handled by the Watchlists AyeAye analyzer on
all Gerrit projects that use it, and not CCing watchers locally has
no effect. Rely on that instead of logic in git cl.

Bug: 41494851, 40242793
Change-Id: I58fdf8c0a741a9189cccec3b3b56d0a8a1c44058
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5276660
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
1 year ago
Peter Boström 74a6ca92bb Clean up stacked-changes dogfood
This removes logspam from `git cl` when a user (like me) hasn't opted
either in or out. DOGFOOD_STACKED_CHANGES=1 is the codified behavior.
This removes the DOGFOOD_STACKED_CHANGES=0 opt-out.

Bug: b/265929888
Change-Id: Ia159f898512d815e3a4b76cc8859c599016a7bec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5274266
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
1 year ago
Aravind Vasudevan 1f441eb375 [fix_encoding] Remove fix_encoding
The fix_encoding module within depot_tools was included back in the python2[1] days to as a be all encoding fix boilerplate that is called across depot_tools scripts.

However, now that depot_tools officially deprecated support for py2 and support >= 3.8[2], the boilerplate is not needed anymore.

* `fix_win_codec()`[3] The 'cp65001' codec issue this fixes is fixed in python 3.3[4].
* `fix_default_encoding()`[5] python3 defaults to utf8.
* `fix_win_sys_argv()`[6] sys.srgv unicode issue is fixed in python3[7].
* `fix_win_console()`[8] Fixed[9].

[1] https://codereview.chromium.org/6721029
[2] https://crrev.com/371aa997c04791d21e222ed43a1a0d55b450dd53/README.md
[3] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=123-132;drc=cfa826c9845122d445dce4f51f556381865dbed3
[4] https://github.com/python/cpython/issues/57425#issuecomment-1093559969
[5] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=29-66;drc=cfa826c9845122d445dce4f51f556381865dbed3
[6] https://crsrc.org/d/fix_encoding.py;l=73-120;drc=cfa826c9845122d445dce4f51f556381865dbed3
[7] https://github.com/python/cpython/issues/46381#issuecomment-1093409968
[8] https://source.chromium.org/chromium/chromium/tools/depot_tools/+/main:fix_encoding.py;l=315-344;drc=cfa826c9845122d445dce4f51f556381865dbed3
[9] https://github.com/python/cpython/issues/45943#issuecomment-1093402603

Bug: 1501984
Change-Id: I1d512a4b1bfe14e680ac0aa08027849b999cc638
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5263016
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Josip Sokcevic 371aa997c0 Delete py2 checks
No script can run on py2 (due to print syntax change), so those
checks are useless (will never be printed).

Change-Id: I9cc7bc8b2665dd09cc7f8939ba255956f96af88a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5262958
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Robert Sesek 911e2a0893 Add `git cl format --mojom` for .mojom file formatting
This is not enabled by default because it is new and should be
considered beta.

Bug: 780263
Change-Id: I7a4813c7ac4cef7441c5373dff4bb1289e7b99b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5259981
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
1 year ago
Mike Dougherty 68c511349d Improve git cl split warning if more than 10 CLs will be created.
This CL updates the warning printed when more than 10 CLs will be
created to be shown whether or not the CLs are being sent to the CQ
and provides guidance on adjusting the number of CLs using the max-depth
flag. This makes the tool more user friendly by preventing a new user
from unknowingly creating many CLs without realizing there is a
supported option to customize the depth.

Additionally, it sets the default for the cq-dry-run option to False
instead of None and logs the value of cq_dry_run when running a git cl
split dry run.

Change-Id: I6feba24d06dd5e88d9005345d5b0a1e15c53e197
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5234543
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Mike Dougherty <michaeldo@chromium.org>
1 year ago
Brian Ryner 3d6dda8241 Always run yapf with vpython3.
The version we are using now does not run under python 2.7.

Add an explicit python_version 3.8 to the inline spec so that we don't
rely on vpython's default version. This is a no-op change when running with vpython3. We should run yapf under 3.11, but this needs additional testing and likely an update of zipp, so we'll do it separately.

Change-Id: If1fccbe6b13c77a770bd1a8c9de0789d543ba890
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5198109
Auto-Submit: Brian Ryner <bryner@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Lukasz Anforowicz 388f822682 Explicitly specify `--config-path` when invoking `rustfmt`.
This prevents `rustfmt` from looking up directory-specific configs (e.g.
`third_party/rust/chromium_crates_io/vendor/tinyvec-1.6.0/rustfmt.toml`)
and using them instead of the Chromium config.

Fixed: 1517348
Change-Id: I5231443479f1f417608ecac263808dc91963948f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5185319
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
1 year ago
Josip Sokcevic 0cba8dd68e [owners] Limit number of concurrent Gerrit connections
R=gavinmak@google.com

Fixed: 319469729
Change-Id: I955fa17c80cee25bc2163a8bca0234cdbb659f62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5186760
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Josip Sokcevic cd076ba1b0 [git_cl] Limit number of concurrent connections
When git cl status is executed, it's possible that Gerrit will throttle
some requests. This change sets upper bound of concurrent connections to
20.

R=gavinmak@google.com

Fixed: b/319248186
Change-Id: I51b1d87109447efc8c86d615f12bcafe8c317a90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5181274
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Josip Sokcevic 450aa8d76c [git_cl] Force lookup CL number
UploadAllSquashed doesn't have access to `cl` object and can't update
the issue number. When a new cl is uploaded with --dependencies flag,
`cl` that is passed to upload_branch_deps is outdated - GetIssue returns
None.

Instead of passing cl, or overriding cl in CMDupload with one generated
by UploadAllSquashed, simply unset lookedup_issue which forces GetIssue
to read value from git config.

R=gavinmak@google.com

Fixed: 1514055
Change-Id: I8a55807b097d464379aade20d9cfa3c01f1db69a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5148352
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Josip Sokcevic 31a99001bd Remove dead code
R=gavinmak@google.com

Change-Id: If27b290ebb575db5ec93b4abcb7f432bedd6f18a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153638
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
1 year ago
Gavin Mak edba22d4eb Fix multiline comment formatting
Many incorrectly formatted comments exist from the switch to
4 space indent: https://crrev.com/c/4836379

Bug: 1514505
Change-Id: I6366f9da812919bd35b999f18fa8a49b7a66c09b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153633
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
Helmut Januschka 6444de14d1 fix crash in case HEAD exists as a file
Bug: 1428373
Change-Id: If9d988d542345dbfa0e02f7c3d6f935b48372df4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5018937
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Helmut Januschka <helmut@januschka.com>
1 year ago
Josip Sokcevic c90f05ebd3 [git cl]: Support --dependencies in new flow
This patch adds functionality for --dependencies if new stack change is
used. However, the user must ensure that parent branch didn't diverge by
running git rebase-update [-n].

Bug: 1441132
Change-Id: Ib2e3e841b6dd22bbdefdc7844d5d157b1d1241d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5095961
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Reviewed-by: Scott Lee <ddoman@chromium.org>
1 year ago
Dirk Pranke 081bca8cb3 git_cl: Attempt again to fix xml format on Win
It turns out that we need forward slashes in one place and back
slashes in two other places, so neither path by itself will work.

This CL changes things to do the slash substitution as needed.

Bug: 1502689
Change-Id: I05681ca5aff9f02a1c4ecc14c3c4e877312118ff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5074657
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
1 year ago
Josip Sokcevic eb48a6ac0f git_cl: Fix xml format on Win
Diff paths are no longer normalized, and we can use forward slashes as
separators regardless of the platform.

R=dpranke

Fixed: 1502689
Change-Id: I75a2fe824972f0d98b28eb2146c6f05ee4ae2d75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5038641
Commit-Queue: Dirk Pranke <dpranke@google.com>
Auto-Submit: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
1 year ago
Thiago Perrotta 197399a8ac depot_tools: add a `--dry-run` alias to `--cq-dry-run`
It is easier to remember.

Bug: none
Change-Id: I075fe57521c9743901f51bd1ed3476145553dc48
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5010037
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
1 year ago
Takuto Ikuta 744bfd2a7b git_cl: show actual gerrit host instead of placeholder
This removes necessity of URL modification to open the settings.

Change-Id: I22314d3e04eac476499773a8680dec32a1886eb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4970438
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
2 years ago
Takuto Ikuta 8abeeaab0f git_cl: prepend http for go link
This allows users to click the URL from terminal.

Change-Id: I0b5c2b9d5a8221c41d5152b529edcf82f97464c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4969974
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Andrew Grieve 491aa5d18a Do not fail "git cl format" when google-java-format.jar is missing
The file is conditionally downloaded in chrome, and we do not want to
have "git cl format" fail when editing a .java file on non-linux /
non-android checkouts.

Bug: 1462204
Change-Id: I5fc3b74484e1d9304089118449678acb506d5831
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4943676
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Yiwei Zhang f2f500022d git_cl: add a long option for git cl patch -b
R=sokcevic

Fixed: 1492418
Change-Id: I09b7b05c8eb4968f079303406c474f90c34b66a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4937884
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Andrew Grieve 69e597f8e5 Do not fail formatting when google-java-formatter is not found
A missing google-java-format should not break older chromium branches
and non-chromium projects. This causes the formatting step to skip .java
files when google-java-format is not available, and introduces an
environment variable GOOGLE_JAVA_FORMAT_PATH to set a custom path.

Bug: 1491627
Change-Id: I5e3155553630ddc59c1a8d197e96079f6a372454
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4930437
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Arthur Eubanks 92d8c4e0cf [git-cl] Ignore moved/copied/deleted files for formatting purposes
Bug: 737568
Change-Id: I9888d1b2c392503a1d98579445cda8eee97bd07f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4904205
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Arthur Eubanks <aeubanks@google.com>
Reviewed-by: Hans Wennborg <hans@chromium.org>
2 years ago
Andrew Grieve 3008d7ec82 git cl format: Enable google-java-format by default.
Removes --google-java-format and adds --no-java.

Does not provide a way to fallback to clang-format, since there is no
established way for projects to declare which formatters they prefer to
use.

Bug: 1462204
Change-Id: Ie116e73ccad0fbd55c968248ae2ebeca130a3f80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4905866
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
2 years ago
Thiago Perrotta 853b29f65d depot_tools: add an `--auto-submit` alias to `--enable-auto-submit`
It is easier to remember.

Bug: none
Change-Id: Ic011c2b0bbbde364b69e5db91566748e72946264
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4892967
Commit-Queue: Thiago Perrotta <tperrotta@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
2 years ago
Eli Trexler 8609345923 Revert "Clear existing Change-Ids from description if issue is 0"
This reverts commit 36d937d16d.

Reason for revert: Not sure the best way to notify you about this, but suspect this is the root cause of https://chat.google.com/room/AAAAXGgrwSo/hZDeSAsoQ4k

Verified via rolling back depot_tools

Original change's description:
> Clear existing Change-Ids from description if issue is 0
>
> git cl upload may not create a new change even if issue is 0 because
> of a leftover Change-Id footer in the commit message.
>
> Bug: 1484251
> Change-Id: Ibee0542e0f5a2cbf930b1882892fbb7640054b69
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4880971
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1484251
Change-Id: Ic3230fd7432f57bf9f3d0266b2e2c0df6a7e9bae
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4893199
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 years ago
Gavin Mak 36d937d16d Clear existing Change-Ids from description if issue is 0
git cl upload may not create a new change even if issue is 0 because
of a leftover Change-Id footer in the commit message.

Bug: 1484251
Change-Id: Ibee0542e0f5a2cbf930b1882892fbb7640054b69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4880971
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Andrew Grieve d7ba85d1eb Add experimental --google-java-format flag to "git cl format"
Flag will be used to test out the formatter, and eventually be removed
and made default (or removed and abandon google-java-format)

Bug: 1462204
Change-Id: I3dc9a77fcabc7513674f5db5eab6979a97d2b315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4864924
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
2 years ago
Andrew Grieve cca48dbbaf Refactor "git cl format" formatters to use a common interface
No behavior change. This is to make it easier to add new formatters.

Bug: 1462204
Change-Id: Ifc9c46ad60fe5024f5dfb0cf781ff468b2cc1044
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4863139
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
2 years ago
Joanna Wang d4dfff088c Fix missing upstream messaging.
Bug: 1455494
Change-Id: Ie428c228d4a3fe2db1f95dbb9c642034de9eec79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4858989
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Joanna Wang bcba178212 Add missing --no-ext-diff when getting external changes.
Bug: 1441663
Change-Id: I66fc01e486ddddb6b8c296d1ed4faf22141b845e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4859062
Auto-Submit: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2 years ago
Joanna Wang 56ee228caf Reland "Remove unnecessary notify=None from git cl upload."
This reverts commit cea35a3f77.

Reason for revert: b/298657697 is unrelated to this

Original change's description:
> Revert "Remove unnecessary notify=None from git cl upload."
>
> This reverts commit 7688e78450.
>
> Reason for revert: afaict there is a gerrit notifications bug b/297928626 unrelated to this change but i'm reverting this anyway and relanding when the gerrit bug is resolved.
>
> Original change's description:
> > Remove unnecessary notify=None from git cl upload.
> >
> > This is a NOOP change for all cases except for "Publish comments on push" which gets fixed with this CL.
> > Our hosts have the notify on each patchset turned off.
> >
> > Bug: 1472724
> > Change-Id: I3672c383b1e4ca1f6243c9b9d2c906473f5037d9
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4797981
> > Reviewed-by: Gavin Mak <gavinmak@google.com>
> > Commit-Queue: Joanna Wang <jojwang@chromium.org>
>
> Bug: 1472724
> Change-Id: I3de1a25fe84a21a2adb8b4bbddb460dd45530418
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4817767
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Joanna Wang <jojwang@chromium.org>

Bug: 1472724
Change-Id: I63cdb99111ae89eb6edd5172d827f84b314c015e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4852217
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak 7f5b53ff8d Remove last py2 workarounds
python3 is the only supported version of python in depot_tools.

Changes include:
  * updating python version requirements
  * removing third_party/six

Bug: 1475402
Change-Id: Ib86231413fcac494ceb27d1783e53b9d86533c26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4845292
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Mike Frysinger 124bb8e53c switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.

Reformatted using:
files=( $(
	git ls-tree -r --name-only HEAD | \
		grep -Ev -e '^(third_party|recipes)/' | \
		grep '\.py$';
	git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"

The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py

Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Daniel Cheng abf4847b04 Fix various type annotations in git_cl.py as reported by pytype.
Most of the changes are straightforward typo fixes.
Two more significant changes:
- the entire ChangeDescription class was moved earlier in the file so
  that it is defined before any type annotations that reference it.
- annotations that use list[...] have been changed to use List[...].
  While this is supported >= python3.9, it seems some parts of the
  Python toolchain (e.g. Python formatting) do not support this yet.

Change-Id: Ifb60f10e2424f79a19229328d19d9fd1d0e87dea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4824618
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
2 years ago