We need to be able to do this from different dirs later.
Bug: b/351071334
Change-Id: I18dd2c71ea52d79a56ccaee88a12be97465b9d2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5723089
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Makes __init__ a bit cleaner, and planning to make _shortname a
property also next, since it can be derived from _remote_url
Bug: b/351071334
Change-Id: I12f4363723172a9cdaba37f6beb8fa37bbf09d72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5718639
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Gated this behind new auth flag explicitly being set (so people who
haven't set anything = default off don't run this, just in case)
Bug: b/351024645
Change-Id: I8498b98404ad89d3ca390d3baa798daee0b4b53b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5698379
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
This feels like bikeshedding, but semantically, we are applying the
changes to a specific repo, and you could take one
GitAuthConfigChanger and apply it to multiple different repos.
(The config host, etc. are usually tied to a specific repo, so there
needs to be some further refactoring to make this actually decoupled
from the working directory, but keeping this small for sane code
review)
Bug: b/351071334
Change-Id: I756f1134be516e19e26e35ffca7f7ceb389aaa30
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5699189
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Note that this logic still isn't run yet, because we only call
ConfigureGitRepoAuth behind new auth flag checks.
Bug: b/351024645
Change-Id: Idca4d1ce3ebd3f2c673f244f85b3cae6da39f8e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5699188
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
This should help give additional confidence while refactoring in
gerrit_util.
R=ayatane, yiwzhang
Change-Id: I03927e072e62f6109571ab699f90db7c51ccc6c0
Bug: b/335483238
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5665455
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Can be used to remove config changes. Not called yet.
There's some logic duplication, will try to clean up later.
Bug: b/351024645
Change-Id: Ibdda4b93e600efc4b84240374e58478e2cc1501a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5693419
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
I'm planning on adding removal for all of these, so sectioning
everything out.
Change-Id: Ieb4369a267dff323cd644cff00d98761800a8a90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5691995
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Potentially makes it easier to test (needs more deps extracted and
injected though).
Change-Id: I3a300264f85f4420d8b41a7cd1155e38341638f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5689683
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Potentially makes it easier to test (needs more deps extracted and
injected though).
Change-Id: I8c551b39c97ec95291995e614c760073b10a4615
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5689682
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
NoReturn applies to functions that never return. Doesn't make sense
to return None or NoReturn.
Change-Id: I1f1a759999a8dad1c2b2a7fd9623e3ea5216c726
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5688607
Auto-Submit: Allen Li <ayatane@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
In nosquash mode, `git cl` is pretty challenging to use since we don't
have issue numbers. All three parts of the triplet id are readily
available though. This CL adds a fallback to `git cl` which looks up the
issue number by getting the change details by triplet_id.
Change-Id: I0839fe75bcb4bc8d60ff36b4da26dc0e419a1493
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5633186
Commit-Queue: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
Change-Id: I575b91f6b6e28ac58160e3c0fc59398df222b150
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5677608
Auto-Submit: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Because running git cl creds-check in every single repo is poor UX for
early dogfooders.
Bug: b/348024314
Change-Id: Ib5641418de7fa5a55a7f67b7069e63c04403852a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5660338
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Running `git cl creds-check` without any credentials will show:
```
Your .gitcookies have credentials for these hosts:
No Git/Gerrit credentials found
```
The first line of the output should not assume that there are hosts. Don't show this line if credentials are not found.
Change-Id: Ie6eba3518f4b270eef5fbe0c51b4494762a3aef4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5663779
Reviewed-by: Scott Lee <ddoman@chromium.org>
Auto-Submit: Gavin Mak <gavinmak@google.com>
Commit-Queue: Scott Lee <ddoman@chromium.org>
Basically there are lots of different formats for everything and
certain things need things in different formats.
Credential helper needs whatever remote the user has configured (which
may or may not have `-review`).
Checking ShouldUseSSO needs the Gerrit host with `-review`.
SSO URL needs the short name (not FQDN), and without `-review`. I
think.
Anyway, this should work now. Probably.
Bug: b/348024314
Change-Id: I495686ecfff43c61fe78d72ccd485bc93388e036
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5662256
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
The CookiesAuthenticator is mutually exclusive with new auth.
Bug: b/348024314
Change-Id: I70f2e1976b54572c330fcc8acff30e8448e540ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5651990
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
(This did not error since this code path is unreachable, to be fixed
in future CL)
Bug: b/348024314
Change-Id: I115b36a828d5e525c54cebdbec5480514e395da7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5651989
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Allen Li <ayatane@chromium.org>
Previously EnsureCanUploadPatchset only had a working implementation
for the CookiesAuthenticator, relying on being able to parse the
user name out of the .gitcookies file.
Additionally, the previous implementation assumed that you would
always authenticate as your primary Gerrit account OR you had
a matching `user.email` gitconfig entry, even though neither of these
is a strict requirement for the upload to work.
The new implementation still short-circuits if issue_owner matches
the configured user.email, but other than this it just asks Gerrit
what the full list of linked emails is for the currently authenticated
account.
The new approach is not only correct, but will now work for all auth
schemes in exactly the same way.
When the accounts do mismatch, you will now see output like:
```
WARNING: Change 5590262 is owned by iannucci@chromium.org, but Gerrit knows you as:
* user@example.org
* other.user@example.com
* primary@real.example.com (preferred)
Uploading may fail due to lack of permissions.
```
R=ayatane@chromium.org, yiwzhang@google.com
Bug: 336351842
Change-Id: I89c1b121c9110e00d1348884aaf025fc783542d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5590262
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
This will allow us to implement EnsureAuthenticated for other
Authenticator implementations.
R=ayatane@chromium.org
Bug: 336351842
Change-Id: I5ff4efd45eb5baa6baa048842510ec6e18e1b8fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5588510
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Previous comment was... lacking. Actually, wrong. It's doing the
exact opposite of lazy loading. Maybe they were trying to use AI code
gen before it existed?
Bug: b/348024314
Change-Id: I068d43fe1abf757cb8b109890a14ca0cefe3fec0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5641090
Commit-Queue: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
This new option allows programatically providing new
description when uploading a new patchset.
Bug: 346174899
Change-Id: I6d7e361b7da0fd06675c04df4fd2f68c7954dd40
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5620640
Commit-Queue: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Running a command line longer that 32k on Windows lead to issues (as
usual). We run git diff in multiple scenarios on a list of changed
files. This list is not partitioned and may lead to a command line
much longer than OS can allow.
This change replaces BuildGitDiffCmd with RunGitDiffCmd that splits
the file list internally and runs git diff multiple times if required.
Change-Id: Icfd8efc7520105b8d98125e90bb96c2bb9bd3a0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5613673
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Aleksei Khoroshilov <akhoroshilov@brave.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
The chromium recipe (and only the chromium recipe?) currently reads this
prop to trigger a clobber build. But support for that in the recipe is
being removed in https://crrev.com/c/5620860. So this removes the
ability to set that arg via `git cl try`. Across all chrome/chromium
builders, that arg was only passed in six builds in the past year. So
it's very unlikely anyone depends on it, or will notice it's gone.
Bug: 346363294
Change-Id: Icf05c9a2fd6f2e9239c735e4c5507aee9a26e0e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5620634
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>