This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年11月04日 15:04 by ncoghlan, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| iss-hooks.patch | willingc, 2015年04月14日 15:01 | |||
| iss-hooks-1.patch | willingc, 2015年04月15日 05:47 | |||
| Messages (12) | |||
|---|---|---|---|
| msg174810 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年11月04日 15:04 | |
Setting up the same commit checks locally that the main repo enforces for incoming patch sets can save a great deal of frustration with the server rejecting "hg push" for changes (this can be especially frustrating if you have already merged changes across branches). The committer section of the devguide [1] should explain how to: 1. Check out the hooks repo from hg.python.org 2. Configure the whitespace checking hook by adding this to hgrc for the relevant repo(s) (adjusting the path appropriately for the checked out location of the hooks repo): [hooks] commit = python:~/devel/hg_hooks/checkwhitespace.py:check_whitespace_single [1] http://docs.python.org/devguide/committing.html#committing-and-pushing-changes |
|||
| msg174812 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2012年11月04日 15:10 | |
Configuring the editor to remove trailing whitespace, and using make patchcheck are other valid solutions to this problem. |
|||
| msg174814 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2012年11月04日 15:33 | |
Sure, but both of those can fail (forgetting to run make patchcheck, using a different editor from your normal one for some reason) Once the commit hook is set up properly, you get alerted to the problem as soon as you try to commit, rather than having to untangle a merge chain when you realise on pushing that you stuffed up the whitespace in the original bugfix commit. |
|||
| msg174815 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2012年11月04日 15:44 | |
I'm not against your proposal. If the goal is to explain how to get rid of trailing whitespace then the other solutions should be mentioned too (I think made patchcheck already is). If the goal is to show how to set up local hooks and where to get them, then the other solutions don't belong there. |
|||
| msg175374 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2012年11月11日 17:29 | |
I would be helped by such an explanation in the devguide. |
|||
| msg240900 - (view) | Author: Carol Willing (willingc) * (Python committer) | Date: 2015年04月14日 15:01 | |
Adds whitespace checking hook setup information to Minimal Configuration section of devguide [1]. Patch is ready for review. [1] https://docs.python.org/devguide/committing.html#minimal-configuration |
|||
| msg240964 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2015年04月14日 17:35 | |
The wording of the patch looks good to me other than one issue: which hook to use. I notice Nick's suggestion is to use the hg "commit" hook. But in the comments for the checkwhitespace hook itself, "pretxncommit" is the suggested hook. The difference between them, AFAIK, is that the "commit" hook is executed after the changeset has been created and applied in the local repo, while the "pretxncommit" hook is called before the changeset is committed and can thus abort the commit. So in either case, you'll see the warning message from the hook if the changeset has extraneous white space but when using the "commit" hook the changeset will be applied anyway and, to fix it, you either have to strip it or commit a fix in an additional changeset. There may be some workflows where using "commit" is a better choice (like when using mq) but I think in general using the "pretxncommit" hook is the better choice. Opinions? https://hg.python.org/hooks/file/default/checkwhitespace.py#l10 |
|||
| msg240994 - (view) | Author: Carol Willing (willingc) * (Python committer) | Date: 2015年04月14日 19:28 | |
Ned, Thanks for the review and feedback. It seems reasonable to me to mention both the "pretxncommit" hook as well as the "commit" hook as well as your brief comments on the difference between the two. I'll make that change to the patch and resubmit. |
|||
| msg241083 - (view) | Author: Carol Willing (willingc) * (Python committer) | Date: 2015年04月15日 05:47 | |
Patch is ready for review. Ned's feedback on "pretxncommit" hook is added. |
|||
| msg241085 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年04月15日 06:09 | |
New changeset b494a25915a9 by Ned Deily in branch 'default': Issue #16405: Explain how to set up the whitespace commit hook locally. https://hg.python.org/devguide/rev/b494a25915a9 |
|||
| msg241086 - (view) | Author: Ned Deily (ned.deily) * (Python committer) | Date: 2015年04月15日 06:13 | |
Thanks for the patch, Carol. (I made a few minor changes before committing: to the file paths and to make it clearer that one should choose one of the hooks.) |
|||
| msg241997 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2015年04月25日 06:49 | |
Oh, so *that's* why my local hook isn't aborting commits when the whitespace check fails :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:38 | admin | set | github: 60609 |
| 2015年04月25日 06:49:50 | ncoghlan | set | messages: + msg241997 |
| 2015年04月15日 06:13:50 | ned.deily | set | status: open -> closed resolution: fixed messages: + msg241086 stage: patch review -> resolved |
| 2015年04月15日 06:09:10 | python-dev | set | nosy:
+ python-dev messages: + msg241085 |
| 2015年04月15日 05:47:20 | willingc | set | files:
+ iss-hooks-1.patch messages: + msg241083 |
| 2015年04月14日 19:28:50 | willingc | set | messages: + msg240994 |
| 2015年04月14日 17:35:44 | ned.deily | set | nosy:
+ ned.deily messages: + msg240964 |
| 2015年04月14日 15:01:49 | willingc | set | files:
+ iss-hooks.patch keywords: + patch messages: + msg240900 stage: needs patch -> patch review |
| 2015年04月14日 14:10:43 | willingc | set | assignee: willingc nosy: + willingc |
| 2013年07月17日 19:02:10 | ronaldoussoren | set | nosy:
+ ronaldoussoren |
| 2012年11月11日 17:29:03 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg175374 |
| 2012年11月04日 15:44:30 | ezio.melotti | set | messages: + msg174815 |
| 2012年11月04日 15:33:13 | ncoghlan | set | messages: + msg174814 |
| 2012年11月04日 15:10:44 | ezio.melotti | set | messages: + msg174812 |
| 2012年11月04日 15:04:11 | ncoghlan | create | |