classification
Title: Handle "git worktree" in "make patchcheck"
Type: behavior Stage: resolved
Components: Demos and Tools Versions: Python 3.7, Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ncoghlan Nosy List: ncoghlan, vstinner
Priority: normal Keywords:

Created on 2017-03-12 06:13 by ncoghlan, last changed 2017-04-09 09:24 by ncoghlan. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 629 merged ncoghlan, 2017-03-12 06:57
PR 633 merged ncoghlan, 2017-03-12 09:39
PR 634 merged ncoghlan, 2017-03-12 09:40
PR 635 merged ncoghlan, 2017-03-12 09:42
PR 1057 merged ncoghlan, 2017-04-09 08:43
PR 1060 merged ncoghlan, 2017-04-09 08:44
PR 1059 merged ncoghlan, 2017-04-09 08:44
PR 1058 merged ncoghlan, 2017-04-09 08:44
Messages (12)
msg289481 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-12 06:13
While backporting issue 29656 to get "make patchcheck" to play nice with git PR branches, I discovered an incompatibility between the way "git worktree" works and the assumptions in "patchcheck.py".

Specifically, in a worktree, ".git" is a file, rather than a directory:

    $ cat .git
    gitdir: /home/ncoghlan/devel/cpython/.git/worktrees/py27

So the current isdir() check should be relaxed to just an exists() check.
msg289529 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-13 03:54
Turns out I missed another isdir() check in get_base_branch(), so this still isn't working properly in git worktree directories.
msg290209 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-24 22:24
New changeset 61a82a5fbf1a674b91764652ab70f5dbb9ba50f2 by Nick Coghlan in branch '3.6':
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#633)
https://github.com/python/cpython/commit/61a82a5fbf1a674b91764652ab70f5dbb9ba50f2
msg290210 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-24 22:24
New changeset a6aac8c87036c3180916b893d66b1e257b5e2ec2 by Nick Coghlan in branch '3.5':
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#634)
https://github.com/python/cpython/commit/a6aac8c87036c3180916b893d66b1e257b5e2ec2
msg290211 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-24 22:24
New changeset ee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7 by Nick Coghlan in branch '2.7':
bpo-29798: Handle git worktree in `make patchcheck` (#629) (#635)
https://github.com/python/cpython/commit/ee10fb9c5b0ae8706bcf7ab70d8d65604f2517a7
msg290214 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-24 22:24
New changeset 6a6d090612dd7deaac2bc0399fad743e5e2db606 by Nick Coghlan in branch 'master':
bpo-29798: Handle git worktree in `make patchcheck` (#629)
https://github.com/python/cpython/commit/6a6d090612dd7deaac2bc0399fad743e5e2db606
msg290604 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017-03-27 12:59
Tools/scripts/patchcheck.py still checks isdir() in get_base_branch():

@status("Getting base branch for PR",
        info=lambda x: x if x is not None else "not a PR branch")
def get_base_branch():
    if not os.path.isdir(os.path.join(SRCDIR, '.git')):
        # Not a git checkout, so there's no base branch
        return None
    ...

Was it deliberate to not change this line?
msg290697 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-03-28 11:00
No, that's the bug that prompted me to reopen the issue. I just got distracted and never submitted the follow-up PR :(
msg291358 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-04-09 08:43
Oops, the new PRs and merges haven't shown up automatically because I didn't fix the spelling of the issue number.

3.7 (master): https://github.com/python/cpython/pull/1058
3.6: https://github.com/python/cpython/pull/1060
3.5: https://github.com/python/cpython/pull/1059
2.7: https://github.com/python/cpython/pull/1057

I'll see what happens if I edit the PR titles after the fact.
msg291362 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-04-09 09:22
New changeset 4c116cb3b3ee38cae229f7e0df0cd2045fe73c27 by Nick Coghlan in branch '3.6':
bpo-29798: Handle git worktree in patchcheck (#1058) (#1060)
https://github.com/python/cpython/commit/4c116cb3b3ee38cae229f7e0df0cd2045fe73c27
msg291363 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-04-09 09:22
New changeset c82d39479a88154bd72a3a304be5f473c118da95 by Nick Coghlan in branch '3.5':
bpo-29798: Handle git worktree in patchcheck
https://github.com/python/cpython/commit/c82d39479a88154bd72a3a304be5f473c118da95
msg291364 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2017-04-09 09:24
OK, this should really be working now (and I checked it on my 2.7 checkout before submitting that PR).

Any further problems found should go in a new issue.
History
Date User Action Args
2017-04-09 09:24:05ncoghlansetstatus: open -> closed
resolution: fixed
messages: + msg291364

stage: needs patch -> resolved
2017-04-09 09:22:52ncoghlansetmessages: + msg291363
2017-04-09 09:22:38ncoghlansetmessages: + msg291362
2017-04-09 08:44:40ncoghlansetpull_requests: + pull_request1207
2017-04-09 08:44:21ncoghlansetpull_requests: + pull_request1206
2017-04-09 08:44:09ncoghlansetpull_requests: + pull_request1205
2017-04-09 08:43:59ncoghlansetpull_requests: + pull_request1204
2017-04-09 08:43:42ncoghlansetmessages: + msg291358
2017-03-28 11:00:44ncoghlansetmessages: + msg290697
2017-03-27 12:59:28vstinnersetnosy: + vstinner
messages: + msg290604
2017-03-24 22:24:55ncoghlansetmessages: + msg290214
2017-03-24 22:24:29ncoghlansetmessages: + msg290211
2017-03-24 22:24:22ncoghlansetmessages: + msg290210
2017-03-24 22:24:16ncoghlansetmessages: + msg290209
2017-03-13 03:54:34ncoghlansetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg289529

stage: resolved -> needs patch
2017-03-12 10:04:15ncoghlansetstatus: open -> closed
resolution: fixed
stage: resolved
2017-03-12 09:42:46ncoghlansetpull_requests: + pull_request523
2017-03-12 09:40:03ncoghlansetpull_requests: + pull_request522
2017-03-12 09:39:44ncoghlansetpull_requests: + pull_request521
2017-03-12 06:57:14ncoghlansetpull_requests: + pull_request517
2017-03-12 06:13:31ncoghlancreate