FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update patchcheck upstream remote verification behavior by kattni · Pull Request #135806 · python/cpython · GitHub

Repository navigation

Update patchcheck upstream remote verification behavior - #135806

Merged
ncoghlan merged 3 commits into
python:mainfrom
kattni:update-patchcheck-remote-behavior
Jun 22, 2025
Merged

ncoghlan merged 3 commits into
python:mainfrom
kattni:update-patchcheck-remote-behavior

Conversation

kattni commented Jun 22, 2025

Copy link
Copy Markdown
Contributor

Currently, if you run patchcheck without a remote named upstream or origin, it fails with the following error:

TypeError: can only concatenate str (not "NoneType") to str

I ran into this during my first contribution, and it required viewing the source code for patchcheck to figure out what the issue was.

To avoid this for others in the future, I have updated the patchcheck get_git_upstream_remote() method to be more robust. The following changes have been implemented:

  • It now checks git remote -v.
  • It looks for remote URLs that include python/cpython and (fetch).
  • In the event that only one is found, it returns the name of that remote, regardless of the name.
  • In the event that multiple options are found, it looks for upstream, origin, and python, in that order, and returns the first one it finds.
  • In the event that none are found, it returns an informative error, including a link to the section of the Dev Guide relevant to creating an upstream remote, and lists the available fetch remotes.

Discussed with @ncoghlan prior to submitting this PR.

ncoghlan self-assigned this Jun 22, 2025
ncoghlan added type-bug An unexpected behavior, bug, or error skip issue skip news triaged The issue has been accepted as valid by a triager. needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes labels Jun 22, 2025

ncoghlan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM, thanks!

Copy link
Copy Markdown
Contributor

Running make patchcheck locally reminded me to update Misc/ACKS (@kattni I used "Kattni" based on your GH profile and website About page, so please let me know if you'd prefer a different entry)

ncoghlan enabled auto-merge (squash) June 22, 2025 04:32

kattni commented Jun 22, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

@ncoghlan Kattni is fine, thank you.

ncoghlan merged commit ac9d37c into python:main Jun 22, 2025

Copy link
Copy Markdown

Thanks @kattni for the PR, and @ncoghlan for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 22, 2025
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
(cherry picked from commit ac9d37c)

Co-authored-by: Kattni <kattni@kattni.com>

bedevere-app Bot commented Jun 22, 2025

Copy link
Copy Markdown

GH-135808 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 22, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 22, 2025
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
(cherry picked from commit ac9d37c)

Co-authored-by: Kattni <kattni@kattni.com>

bedevere-app Bot commented Jun 22, 2025

Copy link
Copy Markdown

GH-135809 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 only security fixes label Jun 22, 2025
hugovk pushed a commit that referenced this pull request Jun 23, 2025
hugovk pushed a commit that referenced this pull request Jun 23, 2025
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
Agent-Hellboy pushed a commit to Agent-Hellboy/cpython that referenced this pull request Aug 19, 2025
* find defined "(fetch)" remotes with "python/cpython" in their URL
* if there is exactly one, use that remote name
* if there is one named "upstream", "origin", or "python",
  use that remote (in that precedence order)
* otherwise report an error listing the defined remotes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip issue skip news triaged The issue has been accepted as valid by a triager. type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL