Add revision number option to gerrit_client.py setbotcommit command. Add
an explicit revision number to a setbotcommit call in the update_files
method.
After creating a new patch-set in the release recipe and verifying it
was created we are adding a comment which could be applied to the
previous patch. Setting `Bot-Commit+1` relied on the default 'current'
revision which may be stale in some Gerrit replicas. This CL applies the
fix suggested in 412739202
Bug: 414681998
Change-Id: I1d380e221864bcf1183c77fa58be4ede9a787ef1
Recipe-Nontrivial-Roll: build_internal
Recipe-Nontrivial-Roll: chrome_release
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6718447
Reviewed-by: Alex Kravchuk <alexanderkr@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Sometimes I want to add a message without touching the attention set.
The default review call will automatically update it regardless. Add
a flag to explicitly control behavior.
Test:
# No attention set option.
$ ./gerrit_client.py ...
-> ignore_automatic_attention_set_rules not included in body of request
$ ./gerrit_client.py ... --automatic-attention
-> body has {'ignore_automatic_attention_set_rules': False}
$ ./gerrit_client.py ... --no-automatic-attention
-> body has {'ignore_automatic_attention_set_rules': True}
Change-Id: Idcf7975ba691942cfe385a2156ef3a3ec064a0b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172486
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
This is a little bit more boiler plate, but the UX is much nicer.
Asserts produce race tracebacks while parser.error produces a clean
error message. This in turn makes it much more obvious that the
user made an error vs the tool crashing.
If gerrit_client was written using argparse, we could just set
required=True on the option, but it's still using optparse, and
that has no built-in support for required options.
Before:
$ ./gerrit_client.py addmessage
Traceback (most recent call last):
File ".../depot_tools/./gerrit_client.py", line 563, in <module>
sys.exit(main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 555, in main
return dispatcher.execute(OptionParser(), argv)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/subcommand.py", line 254, in execute
return command(parser, args[1:])
^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 409, in CMDaddMessage
(opt, args) = parser.parse_args(args)
^^^^^^^^^^^^^^^^^^^^^^^
File ".../depot_tools/./gerrit_client.py", line 547, in parse_args
assert options.host, "--host not defined."
^^^^^^^^^^^^
AssertionError: --host not defined.
After:
$ ./gerrit_client.py addmessage
Usage: gerrit_client.py addMessage [options] [args ...]
gerrit_client.py: error: --host is required.
Change-Id: I2f807628439e6399daaedc00cd42d160505ee4ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6172484
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: 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>
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>
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>