Issue 29656: Change "make patchcheck" to be branch aware (original) (raw)
With the switch to a PR based workflow, I'm finding the current incarnation of "make patchcheck" less helpful than it used to be, as it only checks uncommitted changes, rather than all changes relative to the base branch.
Looking at Tools/scripts/patchcheck.py, it seems like it should be possible to use sys.version_info to calculate a suitable base branch ('master' if the release is alpha, '{major}.{minor}' otherwise), but things get a bit trickier from there:
- the local branches may not be up to date if the PR branch is based directly on a remote branch, so we can't rely on those
- figuring out which remote to use isn't immediately obvious, but we could probably go with an approach of using "upstream/{branch}" if an "upstream" remote is defined, and "origin/{branch}" otherwise
- once we have a base branch to use, then
git diff --name-status {branch}
should give us the file list in a similar format to the currentgit status --porcelain
I'll put together a PR for this approach.