[Python-checkins] devguide: Issue #16405: Explain how to set up the whitespace commit hook locally.
ned.deily
python-checkins at python.org
Wed Apr 15 08:09:07 CEST 2015
https://hg.python.org/devguide/rev/b494a25915a9
changeset: 741:b494a25915a9
user: Ned Deily <nad at acm.org>
date: Tue Apr 14 23:05:25 2015 -0700
summary:
Issue #16405: Explain how to set up the whitespace commit hook locally.
Original patch by Carol Willing.
files:
committing.rst | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/committing.rst b/committing.rst
--- a/committing.rst
+++ b/committing.rst
@@ -304,10 +304,33 @@
will reject all changesets having the wrong line endings, so enabling this
extension on your local computer is in your best interest.
+As a core developer, it can be very helpful to set up the same commit checks
+locally that the main repo enforces for incoming patch sets. This can save a
+great deal of frustration with the server rejecting ``hg push`` for changes
+(which can be especially time consuming if you have already merged changes
+across branches).
+
+Configuring and using the whitespace checking hook found in the `hooks
+repository`_ will help check incoming patch sets. To configure a hook,
+add configuration settings to ``~/.hgrc`` for the relevant repo(s) (remember
+to adjust the path appropriately for the checked out location of the
+`hooks repository`_). To configure a "pretxncommit" hook that will check
+whitespace before the changeset is committed and can thus abort the commit
+if whitespace is found, add::
+
+ [hooks]
+ pretxncommit.whitespace = python:~/path/to/checkwhitespace.py:check_whitespace_single
+
+Another option is to configure it as a "commit" hook; if used, a warning
+will still be issued but the changeset will be applied anyway::
+
+ [hooks]
+ commit = python:~/path/to/checkwhitespace.py:check_whitespace_single
.. _configuration file: http://www.selenic.com/mercurial/hgrc.5.html#files
.. _extended diff format: http://www.selenic.com/mercurial/hg.1.html#diffs
.. _eol extension: http://mercurial.selenic.com/wiki/EolExtension
+.. _hooks repository: https://hg.python.org/hooks
Clones Setup
--
Repository URL: https://hg.python.org/devguide
More information about the Python-checkins
mailing list