Commit Graph

19 Commits (3253a1deca587cc8dd5d83d790cea8f9654e2c33)

Author SHA1 Message Date
Edward Lesmes 071c3b1b31 owners: Support '*' when checking approval status.
Bug: 1166467
Change-Id: Ib6c32b11ca2892841cad477cee61edef38a0ed62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2628702
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Edward Lesmes c40b2406de owners: Move constants inside OwnersClient.
When used as part of presubmit's input_api, we only
expose OwnersClient and not global constants, so
move constants inside OwnersClient.

Change-Id: I8983c5edadafeebff62838d9cd4a19fdce908159
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2621744
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 82b992a165 owners: Initialize db lazily.
This makes it easier to test, e.g. we can mock
DepotToolsClient.BatchListOwners without having to
mock DepotToolsClient first (to avoid initialization).

Change-Id: I9c24ef28ba7a82cd1498e863cc1b4bc825a579d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2616900
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 0e4e5ae594 Reland "[owners] Refactor OwnersClient."
Reland of [1].
Original CL contained some changes to --[tb]r-owners
which are not included in this CL because those changes
were reverted on [2].

- Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
- Make host, project and branch part of GerritClient.
- Rename ListOwnersForFile to ListOwners.

[1] https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587268
[2] https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2611219

Change-Id: Ife2051b8be0460d1c6bc4fbe4e3b0a571d12dafb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2616130
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes b34cd6d8fa Revert "[owners] Refactor OwnersClient."
This reverts commit 9c7f6c25c0.

Reason for revert:
Not working
https://logs.chromium.org/logs/infra-internal/buildbucket/cr-buildbucket.appspot.com/8858807889610091152/+/steps/franky/0/steps/git_cl_upload/0/stdout

Original change's description:
> [owners] Refactor OwnersClient.
>
> - Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
> - Make host, project and branch part of GerritClient.
> - Rename ListOwnersForFile to ListOwners.
>
> Change-Id: I1f610a64f0217ce54e5ce4a210026535adc1c2e5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587268
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
> Reviewed-by: Gavin Mak <gavinmak@google.com>

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

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

Change-Id: I4928df90856526210a4fd4d104e6cc96aa005bc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2613925
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 9c7f6c25c0 [owners] Refactor OwnersClient.
- Remove GetChangeApprovalStatus and GetFilesApprovalStatus.
- Make host, project and branch part of GerritClient.
- Rename ListOwnersForFile to ListOwners.

Change-Id: I1f610a64f0217ce54e5ce4a210026535adc1c2e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2587268
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
4 years ago
Gavin Mak 99399caeac [owners] Add BatchListOwners
BatchListOwners uses git_common's ScopedPool method to run
ListOwnersForFile in parallel for multiple paths.

Change-Id: I545072e16181407665c8b009f87fccfb7355d7d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2585657
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@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
Edward Lesmes ca45aff391 [owners] Fix SuggestOwners when there is only one owner.
If there are less than two owners for the given paths,
current implementation will get stuck in infinite loop.

Change it to return any possible owner.

Change-Id: I75f18e0a00057c58d227dac23dc8572f1fba23f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2572802
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes 8a791e7cf7 [git-cl][owners] Use new API to suggest batch owners.
Change-Id: I2e2b0aff583e6d9b36261acbef87221e29fe7923
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2565145
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 295dd1879f [owners] Add SuggestOwners to OwnersClient.
Gerrit API doesn't provide the score for
an owner of a path, so we can't use the
same algorithm when suggesting owners.

This change introduces a new algorithm to
select the smallest set of at least 2
owners that can approve the change.

Change-Id: If620073bdf63633f171c1480e345dbaf75e9f575
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2556479
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 64e80769c4 [owners] Sort owners by distance
Change-Id: Id10af7bb2fa821c369952402853fae5c847b2f5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2556478
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
4 years ago
Edward Lesmes eeca9c6ee7 [owners][git-cl] Use owners client to show all owners for a file.
Change-Id: I04949d95ca466452a58ea91cf2db86852c0621bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2551378
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
4 years ago
Edward Lesmes e7d1862b15 [owners] Implement GetFilesApprovalStatus for OwnersClient.
Add a utility method to check approval status for files
when no change has been created yet.

Change-Id: I4cc47e2f598cedc7b7aab68bed356bd3ae566cc0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2551373
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
4 years ago
Edward Lesmes b472168267 [owners] Validate owners config in Depot Tools client.
Change-Id: Ia9cb19d2b1f776c41ef7e96e6a0ebfb0fcd41344
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2548029
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Anthony Polito <apolito@google.com>
Reviewed-by: Anthony Polito <apolito@google.com>
4 years ago
Edward Lesmes 829ce021d5 [owners] Add tests for Depot Tools owners client.
Change-Id: I988f5b866560d5839a1121c7129099ffe125fdce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2545108
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes d4e6fb6573 [owners] Implement GetChangeApprovalStatus for Depot Tools
Change-Id: I2d24e4e02e099381e10b29c7e9a09d530cde4a40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2536817
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes b4f4226d15 [owners] Implement ListOwnersForFile for Depot Tools
Add DepotToolsClient to implement the OwnersClient API
for Depot Tools, and implement the ListOwnersForFile method.

Change-Id: I933a262898439d879c919d695aa62d7702b4c9a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2530509
Auto-Submit: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lesmes 91bb7506bd [depot_tools][owners] Add owners client to depot_tools.
Add an owners API that will be used by Depot Tools to
interact with OWNERS files.

The API will be implemented using both owners.py and the
Gerrit Code-Owners plugin REST API. All Depot Tools code
will be modified to use this API.

Change-Id: I7cf059a0895dbae105a2f0b26568fd7b47068f43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2517985
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Anthony Polito <apolito@google.com>
4 years ago