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>
depot_tools supports extracting information from branch name. E.g. if
branch contains fix-\d or bug-\d, commit description will contains
appropriate git footers.
However, such behavior should happen only on initial CL upload. Should
user decide to delete such footer, we shouldn't set bug / fix on any
following PS.
R=ehmaldonado@chromium.org
Bug: 1225663
Change-Id: I66adfdca070083ab66727d132919d47feb7ddd43
Fixed: 1225663
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3010709
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
We found that in the bot environment sometimes we'd check the
full format setting before doing a lazy config update. Adds an
explicit call to ensure the lazy update. Fixes the problem of
the bot environment not running the same format checks in some
cases.
Bug: 1219863
Change-Id: I970d97da462972300f52cbcb382f7da3929b73e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3009534
Auto-Submit: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
In the previous commit https://crrev.com/c/2532835 the option
to order branches by date was added. This CL adds a git config
variable cl.date-order than can be set to achive the same effect.
Change-Id: Iaf24c46c5f7b63b1e518c18aedc455808a2dc752
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2992887
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
This CL adds a new field to the codereview.settings file used by
git_cl for project-wide defaults. If `USE_PYTHON3` is set to True,
then we will run the PRESUBMIT checks under Python3 by default
instead of Python2, unless the PRESUBMIT.py file contains
`USE_PYTHON3 = False` on a line by itself
(as opposed to now, where we'll use Python2 by default unless the
file contains `USE_PYTHON3 = True`).
This will allow us have Python3 be the default for new files
and to eventually eliminate any uses of `USE_PYTHON3` from the
individual presubmit files. Of course, you will have to go in and
explicitly add `USE_PYTHON3 = False` to any Py2-only files prior
to enabling this.
Bug: 1207012
Change-Id: Id8ec45b43940e5bcffeee196398c711c541e733e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2917747
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Quick run is only set when the -q flag is passed. It is not set to 0 by
other flags because only Chromium has Quick run and there are other
depot_tools users. We rely on the CQ to set the flag back to 0.
Bug: 1192827
Change-Id: I3310c9f005343f7d3eea56eaad5f19c7ba751921
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2927818
Commit-Queue: Gregory Guterman <guterman@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
If git push refs/for/ errors out, inspect stdout message to detect
uploadvalidator rejection. If present, present user a solution.
R=ajp@google.com
Change-Id: I70aee7615f3d905127a31bd5679968ade75c234a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2888475
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Users sometimes type in "y" to confirm the default patchset message,
resulting in a patchset being uploaded with "y" as the message.
We can make a fair assumption that no-one would willingly use a patchset
message of "y", so this CL uses the default patchset message whenever
this happens.
(I have personally done this myself and have seen at least one other
person do the same.)
Bug: None
Change-Id: Iad314d35aa830b62152ab2910eb37d876b7e450b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2861643
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Commit-Queue: Michael Cui <mlcui@google.com>
This CL adds support for running PRESUBMIT.py under either Python2
or Python3 as specified in each PRESUBMIT.py file.
To run the checks under Python3, the PRESUBMIT.py file must contain
a line exactly matching "^USE_PYTHON3 = True$". If the file
does not contain this string, the checks will run under Python2.
Different PRESUBMIT.py files in a single CL may thus contain
a mix of 2- and 3-compatible checks, but each individual file will
only be run in one or the other (it doesn't likely make sense to run
them in both by default).
Bug: 1157663
Change-Id: Ic74977941a6519388089328b6e1dfba2e885924b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2832654
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
I recently encountered an error where I forgot to add a changeid locally to
some-but-not-all commits in a stack of commits. When attempting to upload
these commits via `git cl upload --no-squash`, I received a confusing message
instructing me to install the Gerrit commit-msg hook even after the hook was
installed. In order to debug this problem locally, I added the ability to
prevent `git cl upload ...` from attempting to change the contents of
messages. If the --no-add-changeid flag is passed, then the command will
simply fail quasi-informatively.
BUG=None
TEST=attempted to upload this CL via `git cl upload --no-squash --no-add-changeid`, confirm that it fails.
Change-Id: Id5f721c18143448db801095946f490880bb61786
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2828775
Reviewed-by: Dirk Pranke <dpranke@google.com>
Commit-Queue: Gregory Nisbet <gregorynisbet@google.com>
When uploading a large-scale change, many users are automatically CC'ed
on a change. This adds a warning if this is the case and links to a more
appropriate approval for a large-scale change.
Bug: 1194514
Change-Id: Icd336ebdffbccbc9f30a89a33e244a788a768cfa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2798963
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
code-owners plugins wants a git ref in Gerrit (e.g. refs/heads/master)
while Depot Tools wants a local git ref (e.g. refs/remotes/origin/main,
or a git hash).
Add an upstream parameters to be used by Depot Tools, separate from
a Gerrit ref expected by owners_client.
Change-Id: Ieed97a186e3140b3f82830efa189dbe3e4d8c806
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2730049
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Will be used in a follow-up CL to initialize code-owners client.
Recipe-Nontrivial-Roll: build
Change-Id: Iefe9176320b4d1ae7715e88a8db132e815be76ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2717979
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
This change also adds a target_ref flag to presubmit_support.py.
Recipe-Nontrivial-Roll: build
Change-Id: I6de6bb87fc1482b88d9fbebe5e4ad1dbd8ce9748
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2702792
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
When using "git cl patch -b branch_name issue_number" to resolve merge
conflicts in an uploaded CL the cherry-pick stage will probably fail due
to the expected merge conflicts. If you resolve the conflict and then
upload the now-merged CL you will actually create a new CL. This happens
because the SetIssue step is skipped when the cherry-pick fails.
This change sets the issue whenever a new branch is created. This is
safe (the new branch is not being used for anything else) and will
improve the situation in many cases.
crrev.com/c/2636593 is an example of a CL that was accidentally uploaded
as new when it was just supposed to be a resolving of merge conflicts on
an existing CL.
This change was manually tested with crrev.com/c/2107132.
Change-Id: Icb5b8e38feb6f0fa4a007d3924c4d69d2ee4937c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638979
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Some bots use git-cl to upload changes to Gerrit.
Add an option so those can set Bot-Commit+1 on upload
instead of TBR and CR+1.
Change-Id: I5e80ddadedf6c4fe277f8984c35a603da923de5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2679780
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
When using git cl upload --message-file, the text editor prompts the
user to edit the description. This change suppresses the editor when
a message file is passed in.
Change-Id: Ifa568e155e72eeb49f55ded0ddac1b5a940687af
Bug:916230
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2643781
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This is a reland of 968b1fe7d7
Original change's description:
> [git-cl] Use owners client when processing --[tb]r-owners.
>
> Change-Id: Id094bce2aa731359cd8af16f10ce79ae7e02bd85
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2572809
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Change-Id: I9f93d755b10517c5296f7095f735ec2295be34e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2632840
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>