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>
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>
- 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>
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>
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>
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>
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>
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>
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>
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>