[git_cl] Make EnsureCanUploadPatchset work for all auth methods.
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>changes/62/5590262/10
parent
88b222ccdf
commit
005e60ceda
Loading…
Reference in New Issue