Commit Graph

21 Commits (main)

Author SHA1 Message Date
Gavin Mak f936d540e1 Remove __future__ imports
All __future__ imports (unicode_literals, print_function) are already
mandatory in py3. Also remove an outdated py2 comment in
presubmit_canned_checks.py

Bug: 1475402
Change-Id: I27cf6a8268f6dd1081f22af782c4c29a975376ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4867135
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
1 year ago
Mike Frysinger 124bb8e53c switch to 4 space indent
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>
2 years ago
Aravind Vasudevan bb14391a50 Remove unused imports from depot_tools scripts
This change removes some unused imports across depot_tools scripts.

Change-Id: Ic1112065ad1020fc4a3573d3fb9f137915ef439c
Bug: 1475776
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4812185
Auto-Submit: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Aravind Vasudevan c5f0cbb865 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: 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>
3 years ago
Josip Sokcevic 42c5bbbc96 Revert "Use pylint 2.7 for depot_tools"
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>
3 years ago
Aravind Vasudevan 22bf605bb6 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>
3 years ago
Edward Lesmes 5cd75478dd owners_finder: Use code-owners plugin if available.
Change-Id: I94d7b3cdc17651a6fe5dafa261c58f46f37b8439
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2693919
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Gavin Mak d36dbbd730 [owners] Use owners_client in owners_finder.py
This change also adds a ScoreOwners function in owners_client
that replaces user scoring functionality in owners_finder.

Change-Id: Ifd8841c6d320d9bb644907b6eca0a02d4ef35640
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2641532
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes c3c15a1f6b owners_finder: Don't print comments for owners
This feature will not be supported when using Gerrit
Code-Owners plugin.

Change-Id: I7ad0d5bf004ba39818e57fc00e40592a44d1d11f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2638140
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Bruce Dawson 9b4a0570e5 Print clarifying message when no new owners needed
If a CL already has owners on the reviewer list that cover all of the
files - regardless of whether they have approved the change - git cl
owners just prints ** You selected these owners **, which can be
confusing. This change adds an explanation in the no-unowned-files case
and suggests using --ignore-current if more reviewers are wanted.

Bug: 1071967
Change-Id: If60455c5ec15006e09feed39633fa62e3ddf0a04
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2183222
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
5 years ago
Edward Lesmes ae3586b538 depot_tools: Use gclient_utils.AskForData instead of raw_input.
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>
5 years ago
Bruce Dawson 37740e2bc9 Randomize results of git cl owners
git cl owners orders owners by score with alphabetization being the tie
breaker. This leads to some owners being suggested far more often than
others.

Adding a tiny amount of randomization to the scoring leads to an even
distribution of equally qualified reviewers. Less qualified reviewers
will still be sorted into distinct buckets - the randomness is too small
to do anything except break ties.

The tests were updated so that they can tolerate the randomness, but
only for breaking ties.

Bug: 1024083
Change-Id: If7d39d1b3bbd980b80b46ab3f62c65215309bdc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1913642
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 288e358f3f owners_finder: Fix flaky tests.
Sorting owners by score is non-deterministic, so sort by
name too.

Bug: 1009814
Change-Id: I93a9370a5852634b4bbb2768b9ebbb5b866348e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891665
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Sylvain Defresne b1f865dac5 Add a --ignore-self parameter to "git cl owners"
Sometimes CL author is also listed as OWNERS but want to find a co-owner
to review CL. Currently "git cl owners" is unhelpful as it consider the
author's ownership as enough.

Add a --ignore-self parameter to "git cl owners" that will cause the
tool to ignore author's ownership when looking for a reviewer.

Bug: none
Change-Id: Iba110a465a552cd6befb46c77b2e65f60b663a13
Reviewed-on: https://chromium-review.googlesource.com/c/1459625
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
6 years ago
Edward Lemur 707d70b91e Skip files owned by reviewers when quering for missing owners.
Bug: 728298
Change-Id: If813ff41b1668a2cab6c26b65e424fbe574e629c
Reviewed-on: https://chromium-review.googlesource.com/899086
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
7 years ago
Jochen Eisinger d0573ec067 Use OldContents() for OWNERS files to do checks
BUG=141253
R=dpranke@chromium.org

Change-Id: Iacbc2f0571e725e4f2ccf5ea7878f101972289bb
Reviewed-on: https://chromium-review.googlesource.com/476610
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
8 years ago
Jochen Eisinger eb7447605b Configure path to OWNERS.status file via toplevel OWNERS
BUG=694222
R=dpranke@chromium.org

Change-Id: Ie841332129dd6fa8555d2e940c919b812fc9408d
Reviewed-on: https://chromium-review.googlesource.com/467250
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
8 years ago
Jochen Eisinger 72606f8c24 Add support for a global status files for OWNERS
This allows for having some global comments such as timezones or
long-term unavailability.

The comments go into build/OWNERS.status (that way, they should be
available in all repos that map in build/ for the gn config files).
The local can be overwritten in codereview.settings.

The format is

email: status

Comments (starting with #) are allowed in that file, but they're ignored.

BUG=694222
R=dpranke@chromium.org

Change-Id: I49f58be87497d1ccaaa74f0a2f3d373403be44e7
Reviewed-on: https://chromium-review.googlesource.com/459542
Commit-Queue: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
8 years ago
dtu 944b60530e Fix per-file owners check for deleted files.
Previously if you deleted a file that you had per-file owners on, it would fail
the owners check. This fixes that.

Originally, owners.Database used glob to enumerate the directory and added all
the matching files in the directory to some dicts holding the owners
information. If a CL deleted a file, it'd no longer be on the filesystem, so it
wouldn't be in these dicts. There'd be no per-file owners information for it.

With this patch, the Database no longer enumerates individual files. It instead
keeps track of the glob patterns and checks the CL's files against the patterns
at lookup time.

BUG=622381
TEST=tests/owners_unittest.py && tests/owners_finder_test.py  # Unit test included.

Review-Url: https://codereview.chromium.org/2148153002
9 years ago
ikarienator@chromium.org faf3fdf736 An interactive tool to help find owners covering current change list.
BUG=77248

Review URL: https://chromiumcodereview.appspot.com/12712002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@224264 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago