--- a/tests/tools/check_source.sh Sat Jun 09 17:59:46 2018 +0300
+++ b/tests/tools/check_source.sh Fri Jun 15 16:12:50 2018 +0300
@@ -319,26 +319,66 @@
py_files=$(find . -name '*.py' -not -path '*/build/*')
if [ "$1" = "--only-changes" ]; then
if which hg > /dev/null; then
- echo "Only changes will be checked"
+ if [ ! -z "$HG_NODE" ]; then + hg_change="--change $HG_NODE" + msg="for commit $HG_NODE" + msg="in local repository" + echo "Only changes ${msg} will be checked" - py_files=$(hg status -m -a -n -I '**.py')
- if [ -z "$py_files" ]; then
- echo "No files to check"
+ py_files=$(hg status -m -a -n -I '**.py' $hg_change) + if [ "$1" = "--files-to-check" ]; then + if [ -z "$list" ]; then + echo "--files-to-check requires filename as argument" + if [ -e "$list" ]; then + py_files=$(cat $2 | grep '\.py$') + if [ -z "$py_files" ]; then + echo "No files to check" + echo "Usage: check_source.sh [--only-changes | --files-to-check <filename> ]" + echo "By default without arguments script checks all python source files" + echo " only files with local changes are checked. " + echo " If script is called from mercurial pretxncommit hook," + echo " then only commited files are checked" + echo "--files-to-check <file.lst>" + echo " script read list of files to check from file.lst"
+[ "$1" = "--help" -o "$1" = "-h" ] && print_help