Commit Graph

149 Commits (a02b4bf030ddda5d1ffa36ef0325dff4226ec47d)

Author SHA1 Message Date
Aravind Vasudevan a02b4bf030 Fix gerrit new-password URL
This change fixes gerrit new-password URL from <host>-review.googlesource.com/new-password to <host>.googlesource.com/new-password.

Fixed: 1412557
Change-Id: I0c73e890fa9db5e2172d9a88cbc50703675e9f50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4219808
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
2 years ago
Gavin Mak e0fee9fa4b Add BatchListBestOwners and ListBestOwners to GerritClient
ListOwners returns all OWNERS for a file, which is undesirable in cases
when only direct OWNERS are needed.

Bug: 1351212, 1351519
Change-Id: I693b6645c780aa589e8ab24d0b58691f4aeb30f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3823299
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
3 years ago
Leszek Swirski c1c45f8a85 [gerrit] Add more gerrit API wrappers
Add helpers to gerrit_util for:

  * Setting the commit message on a ChangeEdit,
  * Creating a cherry-pick,
  * Getting the contents of a file in a change.

Bug: v8:12849
Change-Id: I1a5de3054a366d480def32942fd42be179ffb749
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3683383
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
3 years ago
Leszek Swirski 4c0c3fbb06 [gerrit] Fix encoding in ChangeEdit
gerrit_util.ChangeEdit was passing the result of b64encode into a %s
format, which was printing the contents with a bytes prefix (b'...').

Decode the bytes object back to a str object before passing it to '%s'

Bug: v8:12849
Change-Id: I8b54b427bbbe8b914444d7486b5a8afbd743de70
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3683382
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@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
Michael Moss 9c28af45e6 Add ability to generically call most Gerrit APIs.
This will make it easier to call new or uncommon Gerrit APIs, without
needing to add dedicated methods for each one. This also makes it easier
to debug API calls by exposing the raw response data, which is often
processed or filtered in the existing wrapper methods.

BUG=1052179
R=linxinan@chromium.org

Change-Id: I0b594a9fdaabae4b0ebb379dc5473f4d6de67a13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3235714
Auto-Submit: Michael Moss <mmoss@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Xinan Lin <linxinan@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
4 years ago
Michael Moss b6ce244503 Add 'create tag' support to gerrit_client and gerrit recipe_module.
BUG=1052179
R=dpranke@google.com, linxinan@chromium.org

Change-Id: I6e220b70e63d990e9257d9fe4d107de7dbd2eb81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3232849
Auto-Submit: Michael Moss <mmoss@chromium.org>
Commit-Queue: Michael Moss <mmoss@chromium.org>
Reviewed-by: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
4 years ago
Xinan Lin 2b4ec95534 Add new subcommand for 'Changes Submitted Together'.
We may need to submit a chain of CLs. With this sub-cmd, we could
track their revisions along the chain, without querying them one
by one.

BUG=1236658
TEST=local run

Change-Id: If5930fb8f01daccff4d7c5c5e91c8db8887d8e47
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3098095
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
4 years ago
Xinan Lin af79f24cae GetGerritBranch should return None if the branch does not exist
Currently gerrit_client retries if received 404, which does not
provide anything meaningful.
It is nature to get 404 for a non-exist branch. I am not sure why
we raise a 200 error per an empty response. I think
we could just accept 404 and return it like other GET functions, e.g.
GetAccountDetails().

BUG=1208430
TEST=local

Change-Id: I054bad99b69c54cc125141108299193f5cc092de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3077363
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
4 years ago
Xinan Lin 1bd4ffa295 Remove wait-for-merge from gerrit client tool
Following comment in crrev.com/c/3039331, submit call
is fully synchronous.

BUG=1207955
TEST=e2e

Change-Id: I9146d43b4d4530ad5064709e418d34e3229e19ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3049672
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
4 years ago
Xinan Lin 0b0738d9fe Add setbotcommit method to gerrit_client
This is required if we want to land a bot-generated-cl.

BUG=1207955
TEST=e2e

Change-Id: Ib758b9782f9951a3ec23ce9970b0db2a48b1b5f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3049573
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
4 years ago
Xinan Lin c2fb26a337 gerrit_client could retrieve the branch and tag info for a commit hash
BUG=1207955
TEST=verified at local

Change-Id: Ife31456371f156d342ddd099bba1521051d700fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3044919
Reviewed-by: Dirk Pranke <dpranke@google.com>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Commit-Queue: Xinan Lin <linxinan@chromium.org>
4 years ago
Raphael Kubo da Costa 9f6aa1ba78 gerrit_util: Make GceAuthenticator also consider proxy errors in httplib2
Some HTTP proxies may return an HTTP error such as 503 when DNS
resolution fails for GceAuthenticator._INFO_URL
(http://metadata.google.internal), which causes e.g. git-cl to throw an
exception rather than falling back to checking for .netrc or
.gitcookies.

Make GceAuthenticator._get() also consider an httplib2 proxy error a
sign that the code is not running in GCE.

Change-Id: Icc094829f9b044176be44e51f3cad49d4a374f25
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2982611
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Marco Georgaklis 85557a08f4 Implemented suppport for getrelatedchanges endpoint in gerrit module
The endpoint documentation can be found here:
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#get-related-changes

This involved adding support for the command in gerrit_client and
gerrit_util and then incorporating functionality and testing into
the gerrit recipe module.

The reasoning for this is to be able to identify chained builds for
improved accuracy of the new test identification for the FLake
Endorser project.

Bug:1204163
Change-Id: Ic60c733540a9afd7ff159408b0ea9ad7aac078e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2928016
Commit-Queue: Marco Georgaklis <mgeorgaklis@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Josip Sokcevic f5c6d8a27d Handle spaces in Gerrit search options
Gerrit rejects requests with 400 Bad request if query string `q`
contains any spaces. Replace spaces with a plus sign solves the problem.

R=thakis@chromium.org

Bug: 1199692
Change-Id: Ic13dda378527594c6cf57b8cb2edf740517811ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2832653
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
4 years ago
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