Commit Graph

39 Commits (main)

Author SHA1 Message Date
Allen Li 04a2e71a92 [metrics] Add new auth metric
Bug: b/358442026
Change-Id: If91494b52fe27177f68e42ec40977fd8ca1fd4cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5786166
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
6 months ago
Takuto Ikuta f97b5e2424 remove references to goma client repository
We don't maintain goma client anymore.

Bug: 41489832
Change-Id: Ib171f1d51b65c2c456dc3580d4e360a380ab6abf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5546605
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
10 months ago
Gavin Mak edba22d4eb Fix multiline comment formatting
Many incorrectly formatted comments exist from the switch to
4 space indent: https://crrev.com/c/4836379

Bug: 1514505
Change-Id: I6366f9da812919bd35b999f18fa8a49b7a66c09b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153633
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year ago
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
Gavin Mak 5f955dfff1 Drop py2 support from metrics files
python3 is the only supported version of python in depot_tools.

Bug: 1475402
Change-Id: Ic925af3a79311b11a953f1d0d4602754488a9de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4824480
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Gavin Mak 5b2255d62d Use exit code 130 for keyboard interrupts
Interrupting is reported with exit_code 1 in metrics and makes it harder
to determine if a user canceled git cl.

Change-Id: I99f35378dcf02cffa39a05317651fcd2c6a0b520
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4684512
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak 019e73a13b Replace metrics link to point to main
https://goo.gl/yNpRDV points to master.

Bug: 1314133
Change-Id: I14628f0a8cfa1cbd00e9287939b19f25b8c21621
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4409720
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Gavin Mak <gavinmak@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Josip Sokcevic 7958e30579 Revert "Move scm.py to lib/"
This reverts commit 688adfe276.

Reason for revert: breaks try jobs

Original change's description:
> Move scm.py to lib/
>
> It belongs there.
>
> Change-Id: I286b50c43c587c39557fc508175efbd4b0f51d51
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4289680
> Reviewed-by: Joanna Wang <jojwang@chromium.org>
> Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>

Change-Id: I662907b8bb4b2e7db82409bd34c3905db7961a12
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4300261
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2 years ago
Josip Sokcevic 688adfe276 Move scm.py to lib/
It belongs there.

Change-Id: I286b50c43c587c39557fc508175efbd4b0f51d51
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4289680
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Josip Sokcevic 4de5deacd4 Explicitly run everything with python3
R=aravindvasudev@google.com, gavinmak@google.com

Change-Id: Iaa5e960c6226dea3a0814c7cb778d952eafb1502
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 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 09f358bae3 metrics: Don't collect metrics on DEPOT_TOOLS_METRICS=0
Before crrev.com/c/2876082, DEPOT_TOOLS_METRICS=0 was the
env var used to disable metrics collection.

Bug: b/191388102
Change-Id: I0db9d034562f2eb1afb53818b3853cef50c09826
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2980230
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jack Neus <jackneus@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Jack Neus <jackneus@google.com>
4 years ago
Edward Lesmes c8f63d390c gclient: Upload metrics for sync'd deps.
Change-Id: I5340fa9b989cccda61e7a14b4cd30749e2f2c017
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2935003
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 9c34906c59 metrics: Don't print notice if reporting build metrics.
Change-Id: Ib7e23cd1b57c6d0497f0e0ff1fe31b38f11bfc00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2876082
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 1e59a247ab metrics: Report bot metrics if DEPOT_TOOLS_REPORT_BUILD is set
If the DEPOT_TOOLS_REPORT_BUILD envvar is set, Depot Tools will
report information about the builder running the command
(e.g. buildbucket project, bucket, builder and build id).

It will also authenticate to the metrics server, and ignore any
requests not made by ChOps service accounts.

Change-Id: I078a4c2170b4226086c42f289fa449bdebc87179
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2861213
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lemur 73065b2067 depot_tools: Make some changes to make metrics collection compatible with Python 3.
Bug: 984182
Change-Id: I55e9e83d01d5a86464cc234c083e4212f0ba4a1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1713217
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur 9217ff8b2c depot_tools: Make metrics Python 3 compatible.
Bug: 984182
Change-Id: I2b7e4be6131558019d461e09d062b52085f330ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1702855
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 18df41e0cf metrics: Collect full timestamps.
Update metrics.README.md and add a metrics_version field.

Bug: None
Change-Id: I17d9032bd787af2a6fc49f80d59e05152d5223b7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1406256
Reviewed-by: Andy Perelson <ajp@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raul Tambre b946b2389c Improve gclient Python 3 compatibility
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

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

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Hans Wennborg 24b5f9087f Metrics: stop trying to print the notice in color and unicode
It breaks gclient for some users depending on locale settings (see bug).
The feature just doesn't seem worth the complexity.

Bug: 934279
Change-Id: I2c6e2b77ab764381db9f2c4e63ff8a84526769bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1520646
Reviewed-by: Elliott Friedman <friedman@chromium.org>
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
Auto-Submit: Hans Wennborg <hans@chromium.org>
6 years ago
Edward Lemur 36974ad871 metrics_utils: Fallback to HEAD if upstream is None.
Bug: 934494
Change-Id: I31035d78888747386a37d4a8b05c148aaed37529
Reviewed-on: https://chromium-review.googlesource.com/c/1481937
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Samuel Huang 98a7e80352 [Metrics] Fix box drawing on Windows, and refactor code.
The Unicode box drawing turn out malformed on Windows (even with
fix_encoding.py). This CL refactors the box drawing code, and makes
Windows box drawing use regular ASCII characters. Details:
* Add print_red_boxed_text() to programatically print box aroun given
  list og strings.
  * Unicode box drawing characters are escaped, removing the use of
    non-ASCII characters in source code.
* Convert message source to generators for greater flexibilty, and
  remove the need for manual horizontal padding.
* Add proper use colorama with Style.BRIGNT and Style.RESET_ALL.
* For Windows, revert to ASCII characters for box drawing.

Change-Id: I71a728db480709b4376d538aaecd701f9197e7ac
Reviewed-on: https://chromium-review.googlesource.com/c/1461249
Commit-Queue: Samuel Huang <huangs@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Jared Saul 2d4a955e90 Fix broken metrics collection dialog spacing
The change around line 29-30 in
https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1368409/2/metrics_utils.py
inadvertently removed an extra space.  As a result, the metrics
collection dialog looks like this:
https://screenshot.googleplex.com/3aGtquydCXM.png

Change-Id: I7c9c08949b0df248e6de4f59ec9cfd573ff40901
Reviewed-on: https://chromium-review.googlesource.com/c/1403577
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Jared Saul <jsaul@google.com>
6 years ago
Elliott Friedman f6a8ae76df [metrics] Use unicode box-drawing chars and goo.gl link instead
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃      METRICS COLLECTION IS TAKING PLACE           ┃
┃                                                   ┃
┃ To suppress this message opt in or out using:     ┃
┃ $ gclient metrics [--opt-in] [--opt-out]          ┃
┃ For more information please see metrics.README.md ┃
┃ in your depot_tools checkout or visit             ┃
┃ https://goo.gl/yNpRDV.                            ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

R=ehmaldonado, mmoss, tandrii

Change-Id: Iab3a5a18aa57e603c8f253f3fcbbf7f96727e003
Reviewed-on: https://chromium-review.googlesource.com/c/1368409
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Elliott Friedman <friedman@chromium.org>
6 years ago
Edward Lemur 687ca907fd git-cl: Set Code-Review label as a git push argument.
Bug: 877717
Change-Id: I6541a971068aae662b086eba84448bd0769f1a09
Reviewed-on: https://chromium-review.googlesource.com/c/1362405
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Peter Boström e28390cc43 Add the opt-in/out commands to metrics notice
Mentioning these commands make it easier for folks to get rid of the
large notice.

Bug: None
Change-Id: I85dd0e1ec0d33999af46f9e20b95bea05bd40a1e
Reviewed-on: https://chromium-review.googlesource.com/c/1330181
Auto-Submit: Peter Boström <pbos@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 01f4a4ff1c git-cl: Add tests for metrics collection.
Bug: 897394
Change-Id: I07959e870fef4e6a6b8e6e7c974397d3306460c1
Reviewed-on: https://chromium-review.googlesource.com/c/1315839
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur fec80c4135 git-cl: Report git push information to metrics collection.
Bug: 897394
Change-Id: I52a31bb4840b5de89b96545a3e7544c6708f148f
Reviewed-on: https://chromium-review.googlesource.com/c/1312240
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 861640f6c8 metrics: Collect git version.
Bug: None
Change-Id: I73545ad59134c6e5dbeb47fb2e8168a5afc0e497
Reviewed-on: https://chromium-review.googlesource.com/c/1296861
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur 5a9ff43554 git-cl: Report Gerrit RPC requests information.
Bug: 897394
Change-Id: I055e844299e262be81d5ac52ef24571b8fdfd47c
Reviewed-on: https://chromium-review.googlesource.com/c/1292245
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andy Perelson <ajp@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur 03d6d11896 metrics: Add function to extract metrics from HTTP requests
Bug: 897394
Change-Id: I92d2514e4347f02dbcf2884bef3a073095ee03a3
Reviewed-on: https://chromium-review.googlesource.com/c/1292242
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur 488362624b metrics: Add a mechanism to notify users when we want to collect additional metrics.
When we change the version number in metrics_utils:

If the user is not a Googler, or has opted out explicitly, nothing happens
and we still don't collect metrics.

If we're collecting metrics from the user, we stop collecting metrics
and display a notice telling them what has changed.
That notice will be displayed ten times, after which we will
resume collecting metrics. A notice telling them we're collecting metrics
will still be displayed.

Bug: None
Change-Id: If1cc12b2fc06f0d6237714c4f182367b1afdf9fb
Reviewed-on: https://chromium-review.googlesource.com/c/1285395
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Edward Lemur c87d45b102 metrics_utils: Print notice to stderr.
Print notice to stderr to avoid interfering with scripts that parse stdout.

Bug: 832386
Change-Id: Ifbcc52809213311489f5c8434b3c16ea53373e57
Reviewed-on: https://chromium-review.googlesource.com/1145697
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Edward Lemur 5ba1e9caee git cl: Start reporting metrics.
Bug: 832386
Change-Id: Iccb71c020aea31db33fc16050cb1100ccf5a7fbb
Reviewed-on: https://chromium-review.googlesource.com/1145902
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Edward Lemur 40764b07d0 gclient: Report project url if it's a known project.
Bug: 832386
Change-Id: I98aba686f8d575def9a9050c77c057b1749e3235
Reviewed-on: https://chromium-review.googlesource.com/1141164
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Edward Lemur 32e3d1e37c Add a library for monitoring.
Change-Id: I64c3d143186be938042c12e2455bdb034d3bcba8
Reviewed-on: https://chromium-review.googlesource.com/1079639
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
7 years ago