# HG changeset patch # User Andrey Skvortsov # Date 1530626951 -10800 # Node ID e762e234181d7603316b549a7cee4dd97d7b443d # Parent e684aed234073f33466a2d0e0e664806af747a1d Add information how to make shelve command work with check_source.sh called from hg hook and added coresponding flag handling in check_source.sh diff -r e684aed23407 -r e762e234181d CONTRIBUTING.md --- a/CONTRIBUTING.md Fri Jun 29 17:53:57 2018 +0300 +++ b/CONTRIBUTING.md Tue Jul 03 17:09:11 2018 +0300 @@ -8,8 +8,16 @@ To avoid pushing "unclean" code, i's recommended to add one of the following commands to pre commit Mercurial hook into .hg/hgrc configuration file. +Unfortunately script can't distinguish between real commit and shelve. If you +are using shelve (or maybe some other affected commands), it's recommended to +use pre- and post- hooks to create flags to skip checks on +some operations. + + ``` [hooks] +pre-shelve.linter = touch .hg/skiphook +post-shelve.linter = rm .hg/skiphook pretxncommit.linter = ./tests/tools/check_source.sh --only-changes ``` or the same done using Docker container, so result will be the same as @@ -17,5 +25,7 @@ ``` [hooks] +pre-shelve.linter = touch .hg/skiphook +post-shelve.linter = rm .hg/skiphook pretxncommit.linter = hg status -m -n -a -n -I '**.py' --change $HG_NODE > files.lst && docker run --volume=$PWD:/beremiz --workdir="/beremiz" --volume=$PWD/../CanFestival-3:/CanFestival-3 --memory=1g --entrypoint=/beremiz/tests/tools/check_source.sh skvorl/beremiz-requirements --files-to-check files.lst ``` diff -r e684aed23407 -r e762e234181d tests/tools/check_source.sh --- a/tests/tools/check_source.sh Fri Jun 29 17:53:57 2018 +0300 +++ b/tests/tools/check_source.sh Tue Jul 03 17:09:11 2018 +0300 @@ -317,6 +317,10 @@ get_files_to_check() { py_files=$(find . -name '*.py' -not -path '*/build/*') + if [ -e .hg/skiphook ]; then + echo "Skipping checks in the hook ..." + exit 0 + fi if [ "$1" = "--only-changes" ]; then if which hg > /dev/null; then if [ ! -z "$HG_NODE" ]; then