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>
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>
This is a reland of commit b5c7f4b46c
Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
Bug: 1475402
Change-Id: I194180494071777b7b9dd91a5c8edabbbf5484c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811218
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This reverts commit b5c7f4b46c.
Reason for revert: missing a replace for urlparse.urlparse
Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>
Bug: 1475402
Change-Id: Idd00fdfe0b3d62785da2789a7dfcc9fbc79b6385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811623
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
python3 is the only supported version of python in depot_tools.
Bug: 1475402
Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
The --param option does not support extended bool logic. It forces
every search query to be AND-ed together. There is no way to do more
OR joins or subclauses like "( X OR Y ) AND Z".
Let's add a new --query option to let people type out the full string
themselves rather than try and support this bool logic directly.
Bug: b/282975918
Test: ./gerrit_client.py changes --host https://chromium-review.googlesource.com --query '( owner:vapier OR owner:briannorris ) is:open project:chromiumos/chromite'
Change-Id: I792e4deec34797295824ec13da41f45eb85e65ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4638081
Reviewed-by: Greg Edelston <gredelston@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Fixes
.../gerrit_client.py:424: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
logging.warn("%s CLs match search query: " % len(result))
WARNING:root:100 CLs match search query:
.../gerrit_client.py:426: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
logging.warn("[ID: %d] %s" % (change['_number'], change['subject']))
when using `gerrit_client.py mass-abandon`.
Also fixes other `logging.warn()` instances in the same method.
No behavior change.
Bug: none
Change-Id: Ib382d78aca18885ad3c8c0a97631dc76ef7cb22d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4631658
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Gerrit may return 409 error to us even if the branch was created.
We should ignore this error if the branch head is the commit we
requested.
Also pre-check the branch status before creating it.
If an existing branch is expected by the caller, simply return
the branch info without sending the creation request.
BUG=1433047
TEST=local run
Change-Id: Ic6184705579f1410cb9c54843cc0bbb4c4ad61b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4436317
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Garrett Beaty <gbeaty@google.com>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
CC list needs to be contained in notify_details. We
can not use --param, because it is a map of recipient
type to NotifyInfo entity. '--param' can not accept a dict
from command line.
BUG=NA
TEST=gpaste/4774055988166656
Change-Id: I1560fe3a6136ab431052bc3fee7d4c8d989c8579
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3438508
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
This value is passed in the JSON body, not in the URL, so does not need
to be escaped, otherwise trying to make a branch/tag from another
branch/tag leads to errors like:
gerrit_util.GerritError: (400) Bad Request: invalid revision "refs%2Fheads%2Fchromium%2F4665"
BUG=1052179
R=linxinan@chromium.org, sokcevic@google.com
Change-Id: I80d709370165fcb84a3375e18b67d4a921be9a8d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3243724
Auto-Submit: Michael Moss <mmoss@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
This will make it easier to call new or uncommon Gerrit APIs, without
needing to add dedicated methods for each one. This also makes it easier
to debug API calls by exposing the raw response data, which is often
processed or filtered in the existing wrapper methods.
BUG=1052179
R=linxinan@chromium.org
Change-Id: I0b594a9fdaabae4b0ebb379dc5473f4d6de67a13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3235714
Auto-Submit: Michael Moss <mmoss@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Xinan Lin <linxinan@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
And add a hook for it in the gerrit recipe_module.
This will allow invocations of gerrit_client to set votes like
"code-review-1" or "commit-queue+1" on CLs. This will be used by bots
to control CLs they just created with update_files().
Bug: 1250084
Change-Id: I888458983165fed5882e5c37cba4a69dbfb9b810
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3207266
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
We may need to submit a chain of CLs. With this sub-cmd, we could
track their revisions along the chain, without querying them one
by one.
BUG=1236658
TEST=local run
Change-Id: If5930fb8f01daccff4d7c5c5e91c8db8887d8e47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3098095
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
This is required if we want to land a bot-generated-cl.
BUG=1207955
TEST=e2e
Change-Id: Ib758b9782f9951a3ec23ce9970b0db2a48b1b5f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3049573
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
BUG=1207955
TEST=verified at local
Change-Id: Ife31456371f156d342ddd099bba1521051d700fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3044919
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Grant the power to gerrit_client cmd to submit a change. Once
we create a change and update it via CMDchangeedit, we can
submit it if the service account has permission.
BUG=1207955
TEST=e2e
Change-Id: Ia3102641ffe5bb72f8f63ad80bf15b5478cf5a2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3039331
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Running './gerrit_client.py' currently shows only "help" as an available
subcommand. Adding these docstrings allows it to properly show all the
other subcommands.
R=sokcevic@google.com
Change-Id: I44c9d63fe8d481cabade50311d0f630b0f747018
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3032207
Auto-Submit: Michael Moss <mmoss@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
The endpoint documentation can be found here:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes
This involved adding support for the command in gerrit_client and
gerrit_util and then incorporating functionality and testing into
the gerrit recipe module.
The reasoning for this is to be able to identify chained builds for
improved accuracy of the new test identification for the FLake
Endorser project.
Bug:1204163
Change-Id: Ic60c733540a9afd7ff159408b0ea9ad7aac078e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2928016
Commit-Queue: Marco Georgaklis <mgeorgaklis@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Gerrit rejects requests with 400 Bad request if query string `q`
contains any spaces. Replace spaces with a plus sign solves the problem.
R=thakis@chromium.org
Bug: 1199692
Change-Id: Ic13dda378527594c6cf57b8cb2edf740517811ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2832653
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
mass-abandon allows users to mass abandon CLs based on search query.
Owner is always specified (either "me" or user defined via -p).
R=gavinmak@google.com, thakis@chromium.org
Change-Id: I789a3a1f3af22867ebbbc50c35b60486206ff403
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2811005
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Add calls to support creating changes, as well as editing and publishing
them in gerrit_client and gerrit_util.
Bug=b:182613582
Change-Id: I0514cf08dce63ab29d99d4485d96fa124006326a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2800811
Auto-Submit: LaMont Jones <lamontjones@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: LaMont Jones <lamontjones@chromium.org>
Passing an invalid --param option in leads to a crash lower down in
the gerrit modules which can be hard to trace back to the original
error: the user forgot the "key" in the "key=value".
Change-Id: I6fe5fab0fad15cf8d25173e0f1c8ea130efc44ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2558651
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
This'll allow to query gerrit from recipes for e.g. current changes in
CQ.
Bug: 685318
Change-Id: I73d08d4b186b2e5fe044fd4d4fafd9db62e27066
Reviewed-on: https://chromium-review.googlesource.com/558939
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>