Commit Graph

132 Commits (f78dd18ee16651fb34e4cfccfa266e151ba6adb8)

Author SHA1 Message Date
LaMont Jones 9eed4238d8 gerrit: add createchange changeedit publishchangeedit
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>
4 years ago
Edward Lesmes 743e98ce87 gerrit_util: Fix checking if code-owners enabled on repo.
Change-Id: I5f518c22be4c5496f91202015c9caf18d0fa1be9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2778638
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 8170c29fd1 Reland "presubmit: Skip owners checks if code-owners plugin is enabled."
This is a reland of 2cf835a9ba

URL-encoded repo path, so chromium/src becomes chromium%2Fsrc
as Gerrit expects

Original change's description:
> presubmit: Skip owners checks if code-owners plugin is enabled.
>
> If code-owners plugin is enable for the repo, skip owners check on
> commit, and skip checking owners format, as that will be done by
> the plugin.
>
> Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: I3038590f3a92cbf7b6dc0ba6eb47f72593a2ccf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2775840
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes 23c3bdc950 owners: Simplify logic to score and suggest owners.
Keep adding owners in the order suggested by Gerrit until coverage is
achieved instead of finding a minimal set of owners, as that takes too
long

Bug: 1186420
Change-Id: Id2ab172db0b2e83ab950191958813163099181be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2751343
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Josip Sokcevic ec3c39536a Revert "presubmit: Skip owners checks if code-owners plugin is enabled."
This reverts commit 2cf835a9ba.

Reason for revert: doesn't work with depot_tools

error 404 Not found: tools (with applied patch from 2729404)

Bug: 1183975

Original change's description:
> presubmit: Skip owners checks if code-owners plugin is enabled.
>
> If code-owners plugin is enable for the repo, skip owners check on
> commit, and skip checking owners format, as that will be done by
> the plugin.
>
> Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
> Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Change-Id: Id4d560701e4b0144e0aafc5263e09ed6927f6222
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2729409
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
4 years ago
Edward Lesmes 2cf835a9ba presubmit: Skip owners checks if code-owners plugin is enabled.
If code-owners plugin is enable for the repo, skip owners check on
commit, and skip checking owners format, as that will be done by
the plugin.

Change-Id: I1663baef4f0f27b00423071343fe740f6da50ce7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2727131
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Gavin Mak 7d690053cb owners_client: Handle missing email in AccountInfo
Bug: 1180316
Change-Id: I8390f72d8a6cd1044ce10b7cbd4573a004a9730c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2705614
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes 110823ba4d Add a GetCodeOwnersClient method.
GetCodeOwnersClient will return a GerritClient instance
if code-owners is enabled for the host, and will fall
back to DepotToolsClient otherwise.

Change-Id: I303147f36cb28ae3a40649fee020e6ea459b2c73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2676989
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Mike Frysinger f1c7d0dd2d gerrit_util: move changes: enable keep_all_votes
The default move behavior resets all non-blocking labels (including
Code-Review) which is not generally what we want.  Preserve them.

Change-Id: I9c49582b4147e27d3ed6a439a610c9c667d7aa7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2586110
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Gavin Mak c94b21d60c [owners] Use new API to list owners for file
This change implements ListOwnersForFile using gerrit's REST API in owners_client.py
Change-Id: Ic454dcd89a8f00f6b9e913e6b8ee9e1169581b38
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2583327
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
4 years ago
Josip Sokcevic df9a802ad2 Add change HEAD cli option to gerrit_client
This option modifies default branch of desired repository.

R=ehmaldonaldo@chromium.org, gavinmak@google.com

Change-Id: I1e20dc8d333c4301eacffff5049e3a98c3d59f75
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2575884
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic f736cabba5 Add retry on git push failure
This adds retry if target is old default branch. This may happen only if
user didn't fetch remote for extended period of time and old default
branch no longer exists.

R=ehmaldonado@chromium.org

Change-Id: I81981049ee006f68a073718180b454c230d055e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2473757
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes b073999c6f git-cl: Print response content on Gerrit transient errors.
Response contents contain useful information when debugging Gerrit
transient errors.

For example, trying to land a WIP CL fails with a 409 Conflict status,
which is not very useful when trying to troubleshoot.
The message returned by Gerrit makes it clearer:

  Failed to submit 1 change due to the following problems:
  Change XXXXXXX: Change XXXXXXX is work in progress

Bug: 1136295
Change-Id: I7e0036785cb3146eae49e29d3c4fa3e156ae7c20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2463987
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic c39ab997ba Support main as default branch
R=apolito@google.com

Change-Id: Ic338c698b8eb8d2e04fc1ef23ae4b13cae08b80f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2404701
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
George Engelbrecht 888c0fe768 ReadHttpResponse: Handle 429s with retries and adjust retry count
We've had reliability issues with gerrit, primarily related to
429 status codes but also DDoS bans. The light DDoS bans can be
very short lived and we extend retries to handle this. Longer
term bans can take up to an hour to lift.

BUG=chromium:1071590
TEST=./gerrit_client_test.py

Change-Id: Iaf68c0d9cc7375aa58367ec0447d54a99f8ebf39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2153089
Commit-Queue: George Engelbrecht <engeg@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
5 years ago
Quinten Yearsley 925cedba7b Run spellchecker on depot_tools
This was made by running `codespell` and `scspell`
and then checking the results.

Change-Id: I169fd5b40294f83015075b4a899fbca263821f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2144602
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
Auto-Submit: Quinten Yearsley <qyearsley@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 5a5537dc63 git-cl: Fix retrieving gitcookies path.
Decode the result of reading http.cookiefile from git config

Bug: 1066992
Change-Id: I1d4f2c8e54f717ef61ab4e630f3f66206c56047e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2132774
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 447507ed82 git-cl: Move GCE detection when creating a connection.
Print it unconditionally when creating the HTTP connection.
The previous check was not capturing all possible failure modes.

Change-Id: Ie519f3c3afdbb2e452fbea2385cd75c3d5d1af84
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2129148
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Josip Sokcevic 464e9ff4f3 Add support for git_cl_tests on Windows platform
Change-Id: I9d3d084e7f48ab991db3db16873f030890ad72d6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2108981
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lemur 57d4742bbb git-cl: Tell users to set SKIP_GCE_AUTH_FOR_GIT=1 when running on cloudtop.
Bug: 1059141
Change-Id: I0a4501946014bd567548fb5396c3dd761606a9bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2091584
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
5 years ago
Edward Lemur a3b6fd06f9 Reland "my_activity.py: Run using vpython3 by default."
Fix issue with gerrit_util.py and add tests.

Change-Id: Ie523ea59ddb93cf5c7fa35f3761310ce96747720
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2081092
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 3b44ac67c9 Reland "gerrit-util: Fix GCE check from behind proxy."
This is a reland of 9ee86e5a46

Fix: s/Httplib2Error/HttpLib2Error

Original change's description:
> gerrit-util: Fix GCE check from behind proxy.
>
> Setting HTTP_PROXY or HTTPS_PROXY environment variables will cause git cl
> to fail.
>
> The behavior of an unreachable server behind proxy is different from a direct
> connection, it won't throw a httplib2.ServerNotFoundError error,
> so catch httplib2.Httplib2Error instead.
>
> Bug: 1050380
> Change-Id: I32e2220483de1fd6222c7fd6063039fb86277ef0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2050947
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 1050380
Change-Id: I9aec01088b0b1c408a1292106d0b21e6d8997040
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2066666
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes ca9a5ebcc4 Revert "gerrit-util: Fix GCE check from behind proxy."
This reverts commit 9ee86e5a46.

Reason for revert: Typo.

Original change's description:
> gerrit-util: Fix GCE check from behind proxy.
> 
> Setting HTTP_PROXY or HTTPS_PROXY environment variables will cause git cl
> to fail.
> 
> The behavior of an unreachable server behind proxy is different from a direct
> connection, it won't throw a httplib2.ServerNotFoundError error,
> so catch httplib2.Httplib2Error instead.
> 
> Bug: 1050380
> Change-Id: I32e2220483de1fd6222c7fd6063039fb86277ef0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2050947
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com,infra-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: Idb17520e71fc1d892694e0d4d1cf1630a42bb482
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1050380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2055390
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 9ee86e5a46 gerrit-util: Fix GCE check from behind proxy.
Setting HTTP_PROXY or HTTPS_PROXY environment variables will cause git cl
to fail.

The behavior of an unreachable server behind proxy is different from a direct
connection, it won't throw a httplib2.ServerNotFoundError error,
so catch httplib2.Httplib2Error instead.

Bug: 1050380
Change-Id: I32e2220483de1fd6222c7fd6063039fb86277ef0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2050947
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 0db01f0fab git-cl: Make tests run on Python 3.
Bug: 1002209
Change-Id: I90de660afd901e544e5557f3af3a56cef4d6adaf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891667
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
6 years ago
Edward Lemur 48cda092cd gerrit_util: Remove RemoveReviewers.
It's not used and uses basestring, which is not supported in Python 3.

Bug: 1002209
Change-Id: I9df900076978636c4a5c75e84432a8cc02d46909
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1891654
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 4ba192e7a9 Reland "gerrit_util: Refactor ReadHttpResponse and add more tests."
This is a reland of 5bfa3ae88d

Replace cStringIO with StringIO and add tests.

Original change's description:
> gerrit_util: Refactor ReadHttpResponse and add more tests.
>
> Bug: 1016601
> Change-Id: Ie6afc5b1ea29888b0bf40bdb39b2b492d2d0494c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1880014
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

Bug: 1016601
Change-Id: I0c83a83202169b6a1acc60bdf6f4cd00eac6e2a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1884461
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lesmes 27eb01c355 Revert "gerrit_util: Refactor ReadHttpResponse and add more tests."
This reverts commit 5bfa3ae88d.

Reason for revert:
Fails when fetching status for cl 1708084 

Original change's description:
> gerrit_util: Refactor ReadHttpResponse and add more tests.
> 
> Bug: 1016601
> Change-Id: Ie6afc5b1ea29888b0bf40bdb39b2b492d2d0494c
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1880014
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1016601
Change-Id: I84bc378ed5f58e911e0900b1a5dbea70dc06ade1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1883677
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 5bfa3ae88d gerrit_util: Refactor ReadHttpResponse and add more tests.
Bug: 1016601
Change-Id: Ie6afc5b1ea29888b0bf40bdb39b2b492d2d0494c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1880014
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur d2a5a4c043 Revert "presubmit_support: Fix tests on Python 3."
This reverts commit a834f39e21.

Reason for revert:
https://bugs.chromium.org/p/chromium/issues/detail?id=1017367

Original change's description:
> presubmit_support: Fix tests on Python 3.
>
> Bug: 1009814
> Change-Id: I2c2a835fc4fa0a7fc9e68dfff680fb0beacb491e
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1869535
> Reviewed-by: Anthony Polito <apolito@google.com>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=ehmaldonado@chromium.org,apolito@google.com

Bug: 1009814
Change-Id: I48907caeca9b9b32e4e3a7cb5a636280d017a4c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1877350
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur b1ae481f7f git-cl: Remove hack to ask for random mirrors when querying Gerrit.
Bug: 881860
Change-Id: I4d37c8fd7cf5804dbc69fa4f87b0f55160afdaf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1874893
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur a834f39e21 presubmit_support: Fix tests on Python 3.
Bug: 1009814
Change-Id: I2c2a835fc4fa0a7fc9e68dfff680fb0beacb491e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1869535
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 67fccdf0c9 gerrit_util: Add tests for CookiesAuthenticator
Bug: 1016601
Change-Id: If049ec7d07ded5c357396fca8b3fcc5510a41871
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1871768
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 202c559cac depot_tools: Include httplib2 using vpython.
Bug: 1002153
Change-Id: I940b9d834c2f76caab2bd86fc5d5d5c3b03b4b46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1871763
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 5b929a4926 depot_tools: Clean up auth.py
Bug: 1001756
Change-Id: I495991c30f7f00de17e7c098e2d88ef7783aff3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1865265
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Marc-Antoine Ruel 8e57b4bc55 python3 improvements
Ran:
  vi $(git grep --name-only iteritems | grep -v third_party)
  vi $(git grep --name-only itervalues | grep -v third_party)
  vi $(git grep --name-only 'print ' | grep -v third_party)

and edited the files quickly with adhoc macros. Then ran in recipes/:
  ./recipes.py test train

There was only a small subset of files that had been updated to use
six.iteritems() and six.itervalues(). Since the dataset size that is
being used in gclient is small (pretty much always below 200 items),
it's better to just switch to .items() right away and take the temporary
performance hit, so that we don't need to come back to rewrite the code.

Recipe-Nontrivial-Roll: build
Bug: 984182
Change-Id: I5faf11486b66b0d73c9098ab0f2ce1b15a45c53e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1854900
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@chromium.org>
6 years ago
Quinten Yearsley d9cbe7ad69 [git-cl] Lint and clean-up git-cl, test, and related modules
In this CL:
 - Clarify some comments.
 - Remove some unused imports.
 - Make some style more consistent (e.g. quotes, whitespace)

Tools used: pyflakes, flake8 (most warnings ignored)

Change-Id: Ibfb6733c8d844b3c75a7f50b4f3c1d43afabb0ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1773856
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
6 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
William Hesse e9e89e3aa5 Improve error message for missing gerrit credentials in git-cl.
Bug:
Change-Id: I058fcd85548c6e17f33de71ed2ad04549294e13d
R: dpranke@chromium.org, iannucci@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/558250
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
6 years ago
Quinten Yearsley 0e617c0294 Change git cl comments to list robot comments.
In particular, only show robot comments from the latest patchset.

Bug: 924780
Change-Id: I12038ddd2d90a5cb561b248de3fd37908d5b927e
Reviewed-on: https://chromium-review.googlesource.com/c/1457282
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@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
Edward Lemur 49c8eafcd5 git-cl: Stop logging response headers on 404 Gerrit RPC status.
Bug: 881860
Change-Id: I96a1e8f3ed9fe032307b49d7a130d512e050369e
Reviewed-on: https://chromium-review.googlesource.com/c/1306013
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 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>
7 years ago
Edward Lemur b0b43f3a9e git-cl: Log response IP and host for Gerrit RPC failures.
Bug: 881860
Change-Id: I32a8c27ba912bf76feda86940c7f30a5462f527f
Reviewed-on: https://chromium-review.googlesource.com/c/1279128
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
7 years ago
Andrii Shyshkalov ba7b0a466d git cl: find which reviewers and ccs are OK for Gerrit before upload.
This adds O(reviewers+cc) RPC to Gerrit before upload,
though done concurrently in up to 10 threads. This information isn't
used yet, but will be in follow up CLs.

R=ehmaldonado

Bug: 877717
Change-Id: I2374f249ee874a71089244309e50e8e88a3dee7d
Reviewed-on: https://chromium-review.googlesource.com/c/1242847
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Andrii Shyshkalov 94faf3281c git cl upload: also explicitly use eu1 mirror for retries.
R=ehmaldonado

Bug: 881860
Change-Id: Ia02905a8b71486d771a691c31114d692e62a369f
Reviewed-on: https://chromium-review.googlesource.com/c/1277796
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Edward Lemur 47faa068e8 git-cl: Make request to upload logs more visible.
Print the message asking the user to upload gerrit logs for git-cl upload
failures after the exception.

Also, initialize the error logger only for git-cl upload, so that the
headers are not overwritten unless git-cl upload is executed again.

Bug: 881860
Change-Id: I8e63432eecca5253e56096e3ad0218eec4058e12
Reviewed-on: https://chromium-review.googlesource.com/c/1277426
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Edward Lemur 83bd7f4cd5 git-cl: Print response headers on 404 Gerrit RPC status.
And ask the user to report the printed headers to the bug.

Bug: 881860
Change-Id: I0a6cc0d90b4a721f72cd7eee4cba59934facbb1e
Reviewed-on: https://chromium-review.googlesource.com/c/1266837
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago
Eric Boren 2fb6310237 Reland gerrit_util: Support OAuth2 bearer tokens in CookieAuthenticator
Bug: skia:8394
Change-Id: I928eaec8459a5905360ce760c6361e4554852b44
Reviewed-on: https://chromium-review.googlesource.com/c/1261796
Reviewed-by: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
Commit-Queue: Eric Boren <borenet@chromium.org>
7 years ago
Vadim Shtayura b250ec16d3 [git_cl] Don't check .gitcookies when running on LUCI.
This CL basically replaces "skip if is_gce" with "skip if default auth method
is not gitcookies".

This presumable makes 'git cl' work on LUCI in a consistent manner. Before, it
worked only if the LUCI bot happened to also be GCE bot.

R=tandrii@chromium.org
BUG=891755

Change-Id: I2caa219a4082438a5e026e728bfb62f46a0c80fd
Reviewed-on: https://chromium-review.googlesource.com/c/1260053
Commit-Queue: Vadim Shtayura <vadimsh@chromium.org>
Reviewed-by: Andrii Shyshkalov <tandrii@chromium.org>
7 years ago