[issue16405] Explain how to set up the whitespace commit hook locally

Ned Deily report at bugs.python.org
Tue Apr 14 19:35:44 CEST 2015


Ned Deily added the comment:

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

----------
nosy: +ned.deily

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16405>
_______________________________________


More information about the Python-bugs-list mailing list