@@ -304,10 +304,33 @@ create or modify versioned files. The public repository has a hook which
304
304
will reject all changesets having the wrong line endings, so enabling this
305
305
extension on your local computer is in your best interest.
306
306
307
+ As a core developer, it can be very helpful to set up the same commit checks
308
+ locally that the main repo enforces for incoming patch sets. This can save a
309
+ great deal of frustration with the server rejecting ``hg push `` for changes
310
+ (which can be especially time consuming if you have already merged changes
311
+ across branches).
312
+
313
+ Configuring and using the whitespace checking hook found in the `hooks
314
+ repository `_ will help check incoming patch sets. To configure a hook,
315
+ add configuration settings to ``~/.hgrc `` for the relevant repo(s) (remember
316
+ to adjust the path appropriately for the checked out location of the
317
+ `hooks repository `_). To configure a "pretxncommit" hook that will check
318
+ whitespace before the changeset is committed and can thus abort the commit
319
+ if whitespace is found, add::
320
+
321
+ [hooks]
322
+ pretxncommit.whitespace = python:~/path/to/checkwhitespace.py:check_whitespace_single
323
+
324
+ Another option is to configure it as a "commit" hook; if used, a warning
325
+ will still be issued but the changeset will be applied anyway::
326
+
327
+ [hooks]
328
+ commit = python:~/path/to/checkwhitespace.py:check_whitespace_single
307
329
308
330
.. _configuration file : http://www.selenic.com/mercurial/hgrc.5.html#files
309
331
.. _extended diff format : http://www.selenic.com/mercurial/hg.1.html#diffs
310
332
.. _eol extension : http://mercurial.selenic.com/wiki/EolExtension
333
+ .. _hooks repository : https://hg.python.org/hooks
311
334
312
335
313
336
Clones Setup
0 commit comments