This reverts commit d447f41294.
Reason for revert: "AttributeError: 'str' object has no attribute 'Extension'"
Original change's description:
> Add AffectedFile.Extension() in presubmit_support
>
> Add convenience method AffectedFile.Extension() for extracting file
> extension in a standard way. Add a test for this new functionality.
> Add a similar test for AffectedFile.UnixLocalPath().
>
> Bug: None
> Change-Id: If591e751fb2e4fb5355ad0b6f93f310667849d68
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6273341
> Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
> Reviewed-by: Dirk Pranke <dpranke@google.com>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
Bug: None
Change-Id: Ic51b0942e3a3267194fb73af5e92c902b2098c4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6279837
Auto-Submit: Gavin Mak <gavinmak@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Add convenience method AffectedFile.Extension() for extracting file
extension in a standard way. Add a test for this new functionality.
Add a similar test for AffectedFile.UnixLocalPath().
Bug: None
Change-Id: If591e751fb2e4fb5355ad0b6f93f310667849d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6273341
Commit-Queue: Anton Bershanskyi <bershanskyi@gmail.com>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Blocking developers from uploading (even WIP) CLs to Gerrit during a
production freeze seems unnecessary and too strict. By turning
CheckFreeze into an "on commit" presubmit check, developers will be able
to upload CLs for review, but not submit them during a freeze.
Change-Id: I199c6c3edcbe1e2d69e4caf74f2d4c9060e98e54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5932363
Auto-Submit: Philipp Wollermann <philwo@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
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>
When opening a text file it is important to specify encoding='utf-8'
since otherwise the behavior will depend on your system locale. This
change fixes various encoding omissions in PRESUBMIT.py files, found
when presubmits were run when uploading crrev.com/c/4290775.
Bug: 1418846
Change-Id: Ief5f6d6bb749de95bc4071055492e6c9c6b6c56d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4292516
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
depot_tools codebase uses py3 and there's limited py2 usage, namely for
presubmits. This CL drops running most of py2 unit tests since there are
no longer useful.
Bug: 1357152
Change-Id: I49a3df503026bc6918362a9b5600f5714eb5c87a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3872425
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@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>
Run unit tests only on commit since it's way too slow for upload. User
can still run tests on local machine via `git cl presubmit` or directly.
This CL reduces time it takes to upload from 2+ minutes to ~10s.
R=apolito@google.com
Fixed: 1263688
Change-Id: Id96c049296eea7c0a4d1e484dce6ae4296aa8041
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3249192
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
my_activity.py talks to third party (e.g. review.coreboot.org). Without
certifi package, making https connection may result in
CERTIFICATE_VERIFY_FAILED.
Adding certifi package to .vpython (py2) doesn't work, so this change
drops py2 support for my_activity.py.
R=gavinmak@google.com
Fixed: 1255921
Change-Id: I515b14c81d37a52d482d08085d8029c791911ae8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3206906
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Try to parse json files on presubmit and add warning it if unable to
parse.
R=apolito@google.com
Bug: 1223923
Change-Id: I67ab4702cb9b995aace6527f4a04f1a1068db7d5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3019692
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: Anthony Polito <apolito@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>
This fixes the issue where presubmit_canned_checks issues a warning if
optional arguments in CheckAuthorizedAuthor are not used at all.
This relands commit b09f2bb2f2 with some
additional changes.
R=apolito@google.com
Bug: 1098560
Change-Id: If323d90ab7d6bcca68ed89142ea67edc4be057d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2373216
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
This reverts commit 149a3b7581.
Reason for revert: warnings are issued if no optional parameters
are passed.
Original change's description:
> Warn when non-inclusive parameters are used
>
> R=apolito@google.com
>
> Bug: 1098560
> Change-Id: Iabc2a5d89a6af1418c1228f3c09eacbbd799b5c7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2355112
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Josip Sokcevic <sokcevic@google.com>
TBR=apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com,sokcevic@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 1098560
Change-Id: Ib0f188de90121c692f5c0d7271938ee312917fd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2376042
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
gclient_utils.AskForData will use raw_input on Python 2 and input on Python 3.
Bug: 1063976
Change-Id: I93c059c4e4454d01787716b5a0a2641ad5253f53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2116370
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Interrupt tests after 3 min, so that failures can be
surfaced before the presubmit step gets interrupted
on the bot.
Change-Id: Ia0efebaac5a0c5072b974a4fbbcb14fe672017ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2098942
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
When running `git rev-parse REV^{commit}` in Windows, `^` must be
escaped.
However, it was escaped more times than necessary.
Split IsValidRevision to call ResolveCommit, add tests to ResolveCommit,
and run scm.py tests on Windows.
Change-Id: I761a820394c8b5410d68b6ccd6c352c41c30c88c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2092904
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
For bonus points, this also fixes PRESUBMIT so that it actually checks
the manifests.
TBR=bpastene@chromium.org, tandrii@chromium.org
Bug: 1032743
Change-Id: I4dac5a520e333e3c429597684a44ece83d21c5fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1960950
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
I have verified that all JSON files currently in depot_tools
pass this check.
Change-Id: I8247653a8161adf69b20d0a837b9f7723936ade2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1620308
Reviewed-by: Sean McCullough <seanmccullough@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
The new version uses SHA256 for uploads by default. It also fully supports
$ResolvedVersions and 'selfupdate-roll'.
The roll was generated by:
$ ./cipd selfupdate-roll \
-version-file cipd_client_version \
-version git_revision:fb963f0f43e265a65fb7f1f202e17ea23e947063
BUG=821194, 870166
R=nodir@chromium.org, iannucci@chromium.org
Change-Id: If7c23c43ff2c1bf50c9c50f4e9e17a23e84859b9
Reviewed-on: https://chromium-review.googlesource.com/1227431
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Nodir Turakulov <nodir@chromium.org>