Improve GitHub repo owner/name storage.
Review Request #15342 — Created Sept. 24, 2026 and updated
The way that GitHub repos were storing their owner name was quite
awkward. Each individual form (private user, public user, private org,
public org) had its own prefix, and when we'd need to conditionally look
up keys based on this.This change adds a new storage mechanism and accessor for the GitHub
repository owner and name. These are stored in a new canonical form by
the GitHub repository form(s). If the repo does not have the new
canonical form, it will fall back to the ugly lookups previously used.
The fallback (andcheck_repository(), which resolves the owner and
name inline from submitted form data before anything is saved) respects
plan_field_prefix, keeping subclasses like GitHub Enterprise working.As part of this,
get_repository_display_path()no longer
reverse-engineers the owner and name from the clone URL, since the same
information is available in extra_data. If the stored data is unusable,
it falls back to the raw path rather than parsing it.The
_get_repository_owner_raw()and_get_repository_name_raw()
methods are removed. Their only remaining caller was
check_repository(), which now resolves the owner and name itself.
Ran unit tests.
| Summary | ID |
|---|---|
| ulsqxkwnsuosurznqrplyxxyozyrmvwm |
| Description | From | Last Updated |
|---|---|---|
|
Should we call .lower() on the owner and name when we save it so that its always in the casing … |
|
|
|
This calls GitHub directly, so it won't work for GitHub Enterprise. We should use self._hosting_service_cls here instead. |
|
|
|
We should document that this can now raise KeyError and InvalidPlanError. |
|
-
-
Should we call
.lower()on the owner and name when we save it so that its always in the casing that GitHub uses in its API? Instead of always having to remember to call.lower()when comparing them. -
This calls
GitHubdirectly, so it won't work for GitHub Enterprise. We should useself._hosting_service_clshere instead. -
- Commits:
-
Summary ID ulsqxkwnsuosurznqrplyxxyozyrmvwm ulsqxkwnsuosurznqrplyxxyozyrmvwm - Diff:
-
Revision 2 (+806 -298)