The validate_prefix file is now rolled out on prod so we
don't need that check any more.
Bug: 1116488
Change-Id: Ibbbfd29366e3e41d8e52d65dd7553f2e521ffd63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4167358
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Weilun Shi <sweilun@chromium.org>
Commit-Queue: Weilun Shi <sweilun@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This gives users an idea of what changes they are applying.
Bug:1382528, 1405491
Change-Id: Icb1e94f193b9cba3d80cc918c2abb11c2527ad3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4082289
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This new option (-n,--no-browser) prints the issue URL instead of opening it in
the browser. This is helpful, for instance, if you're SSH'ed in from a
Chromebook.
Change-Id: I28793280901f054af4eed2dbf2ce1fd109b8d37b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4121245
Commit-Queue: Orr Bernstein <orrb@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
A change ref's format is: refs/changes/X/Y/Z where X is last two digits of the CL number, Y is the entire number, and Z is the patchset number.
In cases where Y ends in XXXX09, for example, we incorrectly fetch
refs/9/XXXX09 instead of refs/09/XXXX09.
Bug: 1382528
Change-Id: Icc0b08e9ee451a75c07039913418a6802b2b62fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4080591
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
Description changes shouldn't prompt. Changes like these that don't
change code or the merge base won't get overriden anyway.
Bug: 1382528
Change-Id: Ie1947a28ea97a8383a791e76738a2ad20c349878
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4033329
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
upload currently overwrites any external changes, e.g. edits/rebases
in Gerrit. Check for these on upload and provide the ability to
incorporate those into the CL.
Bug: 1382528
Change-Id: Id32bf8804c4cdeb12b6a5a7cf206e033bbccd453
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3975855
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Adds --no-python2-post-upload-hooks to git_cl.py. This causes any
post upload hooks to only run under Python 3. Without this, uploading
CLs from builders that omit Python 2 causes the CL the step to fail
after the CL is uploaded.
Bug: 1340617
Change-Id: I5fb45922fb05b28ad570091f9e285dd533d92336
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3996467
Auto-Submit: Brian Sheedy <bsheedy@chromium.org>
Commit-Queue: Joanna Wang <jojwang@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
The change updates git_cl to check for "banned words" too in the stdout to add helpful feedback when the upload fails due to banned words.
Bug: 1375130
Change-Id: Ic29faae9d9601face8455ffbb7314955261ffd57
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3961632
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
For some types of changes, git cl split generates too many small CLs.
--max-depth provides one way of generating larger CLs when the author
judges that the larger CLs do not adversely affect reviewability (e.g.
20x 1 line CLs packed into 1x 20 line CL is generally fine).
Fixed: 777781
Change-Id: I64426ff4723fbc412fbc47f3cc12767433aeb8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3933974
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Currently, the --revision flag to git cl try will cause a gitiles commit
to be set that uses the provided revision, the gerrit host and project
of the CL to test and the target ref of the CL to test. Since the flag
is intended to control the version of source to check out and have the
patch applied to, using the gerrit host instead of the gitiles host will
result in gitiles commits that won't match the repo_path_map in gclient
configs.
Change-Id: Ie391cc9c636f3a9c87116dbb781267031569e67b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3907186
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Garrett Beaty <gbeaty@google.com>
This is a reland of commit 10dbd7babd
Original change's description:
> Remove old DepotToolsOwners implementation
>
> code-owners should have been enabled for most hosts that depot_tools
> supports by now. Remove our own implementation and rely on code-owners.
>
> Change-Id: Iaf0d3db65b2e5063b67d42b92188c4ec51d2cd9a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3783475
> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
Change-Id: Ic87f34411bb38b91fcf49adb07601ae10244e828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3881043
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Vanilla git has a git-send-email(1) subcommand. `git cl upload` should
follow suit by using the same flag name to be consistent and avoid
confusion.
[1]: https://git-scm.com/docs/git-send-email
Bug: none
Change-Id: I47ff8e03bd11915e99804fe1695046d874efc4e0
Tested: `git cl upload --send-email` to upload this very own CL
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3854330
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
code-owners should have been enabled for most hosts that depot_tools
supports by now. Remove our own implementation and rely on code-owners.
Change-Id: Iaf0d3db65b2e5063b67d42b92188c4ec51d2cd9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3783475
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Recent gerrit issues made it obvious that "git cl presubmit" relies on
gerrit much more than most people would expect (the expectation is zero
for many people). This makes presubmits flaky or much slower under poor
network conditions, and it means that the presubmit step may drastically
underestimate how long it takes to run because of a
cl.FetchDescription() that may occur outside of the timed portion of the
presubmits.
This change wraps more network-touching steps in try/except blocks, to
make them robust. It also gets them to check for the existence of a
PRESUBMIT_SKIP_NETWORK environment variable. And, it prints the elapsed
time to get the CL description if this is inordinately long.
Bug: 1350227
Change-Id: I7954fd50e928fd24975a4f61a316cb280542ebbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3813095
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Currently, `git cl help baseurl` fails as it tries to execute the
subcommand, completely bypassing the help.
Parse the arguments early so that the help command runs cleanly for
baseurl.
Fixed: 1345909
Change-Id: Icad7aca6cdc7c9938e91a421cb72e08433a30fd4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3776942
Auto-Submit: Thiago Perrotta <tperrotta@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
When a repository doesn't work with Gerrit, it doesn't make sense to
create GerritAccessor and pass it to presubmit checks.
gerrit.host is stored into git config when codereview.settings file contains GERRIT_HOST item.
Change-Id: I9740950caf85a1da9a6e4ae12e3612625cf0cec5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3687235
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Remove unnecessary os.listdir call and fix infinite loop on Windows if
no file was found in a tree.
Change-Id: I82a8763e807bbc0ce6fcae6b35a370ffe3b34943
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3687234
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Aleksey Khoroshilov <akhoroshilov@brave.com>
Some of the expensive checks when running presubmit --all, such as
CheckStableMojomChanges (~300 s) and CheckAddedDepsHaveTargetApprovals
(~200 s) only look at diffs and are therefore guaranteed to be NOPs when
running presubmit --all or --files=. Passing along the no_diffs state
lets these expensive checks be skipped, thus allowing for faster
iteration times.
Initial testing suggests that (with some supporting changes in the
Chromium repo) this reduces "presubmit --all" times by about ten
minutes, or a bit more than 10%, and additional improvements may be
possible.
Special handling for the no-diffs case also offers a simple way to avoid
presubmit failures that happen whenever all files are flagged as being
changed.
Finally, and perhaps most importantly for having a presubmit --all bot,
when --no_diffs is passed we can treat errors like "Issue wasn't
uploaded" and "Add a description to the CL" as messages, thus making it
possible to have zero presubmit errors when run on origin/main.
Bug: 1320937, 1322936
Change-Id: I0d09dd4aae8fdaa48c8b2f89337441cf96dcff72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3628368
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
All of the PRESUBMIT.py files in the Chromium repo are running under
Python 3. However "git cl presubmit" also works with other repos where
some PRESUBMIT.py scripts still run under Python 2. This means that
the Python 2 presubmit commit checks step cannot simply be disabled.
That meant that Chromium was paying up to a one-minute cost just to
setup for and look for Python 2 scripts that it doesn't run.
This change runs the Python 3 PRESUBMIT.py scripts first, and keeps
track of whether any were skipped. If none were skipped then the
Python 2 PRESUBMIT.py stage can be skipped.
Note that the child scripts of PRESUBMIT.py scripts may still be run
under Python 2, but that is orthogonal to this change.
Bug: 1313804
Change-Id: Ib65838223f232f1e78058d6a08ea15a89f442310
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3614453
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
LUCI bucket can take a few different formats, and it's not clear which
one `git cl try` wants. So this clarifies it a bit.
Bug: None
Change-Id: I4816cf17e3af376d447395021fbc3544616c5451
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3624550
Auto-Submit: Ben Pastene <bpastene@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
When doing presubmit bisects (walking back through git history to see
when a presubmit regression was introduced) it is inconvenient to have
to create a branch at every step, and clean up the branches later. This
change makes having a branch optional, when using --force mode.
Bug: 1309977
Change-Id: I9fb6235620cf6c2e856359d2c25f1ef00c5da554
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3611025
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Also make swift lint strict to catch every formatting errors.
Bug: 1263872
Change-Id: Ie717c1f03ec1a0257cafceecc2055767d0be2077
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3605589
Reviewed-by: Brian Ryner <bryner@google.com>
Auto-Submit: Olivier Robin <olivierrobin@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
swift format is only available on mac hosts.
Swift formatting is disabled by default. It will be
enabled by default on mac host in another CL.
Change-Id: Id603be203edd44b6419d545027c249111abe1baf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3550197
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Chromium's presubmits contain a lot of latent errors - presubmit errors
that will trigger the next time a file is modified, but have been
waiting for years. Flushing those out with "git cl presubmit --all"
works poorly because it exercises all presubmits simultaneously, which
is too slow and triggers too many failures. Adding a --files option lets
small areas of the tree or specific file types to be exercised in a
controlled manner.
Bug: 1311697
Change-Id: I36ec6a759a80000d6ed4a8cc218ece327d45f8d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3559174
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
depot_tools has no versioning. It's hard to know if reported issues were
caused due to outdated depot_tools or actual unresolved bug.
This CL adds basic information about depot_tools version and it's
included in presubmit failure.
R=aravindvasudev@google.com, gavinmak@google.com
Change-Id: If8577c0826063693a7278a57a0cce629d4b1325f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3541061
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Currently, post upload presubmit hooks are exlusively executed with py2,
regardless of USE_PYTHON3 magic variable. This change adds py3 support
in the same fasion as regular presubmit hooks.
R=aravindvasudev@google.com
Fixed: 1297712
Change-Id: Ib464f8563e4135a63fc48692d27c8692fe1f630b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3469285
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
If git cl upload fails due to a private key being detected,
print more useful message for git-cl users.
R=aravindvasudev@google.com
Fixed: 1201742
Change-Id: Ida5c9c9788058dc17c1c50034c9b0b8831cfbd20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3453203
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.
Bug:1262286
Change-Id: I4b8f8fc521386419a3121bbb07edc8ac83170a94
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413679
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
This reverts commit 22bf605bb6.
Reason for revert: breaks gclient sync
Original change's description:
> Use pylint 2.7 for depot_tools
>
> This includes a few fixes for specific errors, and disables several new
> warnings introduced in this version, in order to allow for an incremental migration.
>
> Bug:1262286
> Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Bug: 1262286
Change-Id: Ieb946073c7886c7bf056ce843a5a48e82becf7a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3413672
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This includes a few fixes for specific errors, and disables several new
warnings introduced in this version, in order to allow for an incremental migration.
Bug:1262286
Change-Id: Ie97d686748c9c952e87718a65f401c5f6f80a5c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3400616
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Currently, calling a command like "git cl patch crrev.com/c/1234567"
will fail with "git cl: error: Invalid issue ID or URL." as no scheme is
supplied (i.e. "git cl patch https://crrev.com/c/1234567" is considered
valid).
This cl removes the requirement for supplying a scheme. Instead, the
script attempts to add "https://" where it would've thrown an error
previously. If the resulting string is valid, it is used. Otherwise, an
error will still be thrown.
Bug: 1223200
Change-Id: I24ee4df48b5f5d434f3abe270f5c3e793c347cc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2983443
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Chrome is far enough though its Py2->Py3 transition that it makes sense
to change the default here. The default is used whenever a .py file does
not have a shebang at the top of it.
Bug: 1062053
Change-Id: Ie8472f751c1366248d7797a0aaae36c836d9c426
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3282072
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Those comments are from bots and not useful when running git cl
comments.
R=ajp@google.com
Fixed: 1266986
Change-Id: I6a8f8f81e02e4b4624027c4c95546bf5e3e7244b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3268350
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Andy Perelson <ajp@chromium.org>
Reviewed-by: Andy Perelson <ajp@chromium.org>
When CheckPatchFormatted presubmited canned check is executed, it runs
git cl format with --dry-run. When dry-run is used, exit codes are
ignored and we rely on only on stdout message to detect if formatting is
needed or not. This itself is wrong, but changing this will likely
require significant redesign.
This patch appends stderr output to stdout message on non-zero exit code
and therefore allowing git cl format to actually exit with code 2.
R=gavinmak@google.com
Fixed: 1264111
Change-Id: I5eccf34f533640fd93209c97d1c8d9c85bb94d83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3249191
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This CL provides minimal `git cl format` support to enforce correct Rust
formatting in presubmit checks. For now the files are always fully
formatted - there is no support at this point for formatting only the
changed lines.
Manual tests (after temporarily, artificially introducing a formatting
error to one of .rs files under build/rest/tests):
*) git cl presubmit
Result: The src directory requires source formatting.
Please run: git cl format
*) git cl format --dry-run
Result: Pretty/colorful diff printed out.
*) git cl format
Result: Temporary formatting errors are fixed.
Bug: chromium:1231317
Change-Id: I114ece90630476f27871ebcd170162caa92c0871
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3054980
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: danakj <danakj@chromium.org>
cl/398464215 changed the weblink name from "gitiles" to "browse",
BUG=1254111
R=linxinan@chromium.org, sokcevic@google.com
Change-Id: I1aa5b47657b5c5619f7b56c53e3593d2f2e391f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3194121
Auto-Submit: Michael Moss <mmoss@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
It is occasionally useful to be able to run git cl format against some
specific upstream without having to configure branches in git. As
CMDformat can't easily take "git-diff-like" args, add an explict
--upstream argument.
This has come up a few times in the past and hopefuly the new arg will
be discoverable enough in --help for git cl format to help people.
Bug: 832295, 1082520
Change-Id: I2f3a33d719104ffd97cfa388178e38bfe8731c0e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3124674
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Tomasz Śniatowski <tsniatowski@vewd.com>