##// END OF EJS Templates
scripts: let validate-commits default to testing the draft changes upto current
Thomas De Schampheleire -
r8281:68861940 stable
parent child Browse files
Show More
@@ -1,68 +1,74 b''
1 1 #!/bin/bash
2 2 # Validate the specified commits against test suite and other checks.
3 3
4 4 if [ -n "$VIRTUAL_ENV" ]; then
5 5 echo "Please run this script from outside a virtualenv."
6 6 exit 1
7 7 fi
8 8
9 9 if ! hg update --check -q .; then
10 10 echo "Working dir is not clean, please commit/revert changes first."
11 11 exit 1
12 12 fi
13 13
14 revset=$1
15 if [ -z "$revset" ]; then
16 echo "Warning: no revisions specified, checking draft changes up to the current one."
17 revset='draft() and ancestors(.)'
18 fi
19
14 20 venv=$(mktemp -d kallithea-validatecommits-env-XXXXXX)
15 21 resultfile=$(mktemp kallithea-validatecommits-result-XXXXXX)
16 22 echo > "$resultfile"
17 23
18 24 cleanup()
19 25 {
20 26 rm -rf /tmp/kallithea-test*
21 27 rm -rf "$venv"
22 28 }
23 29 finish()
24 30 {
25 31 cleanup
26 32 # print (possibly intermediate) results
27 33 cat "$resultfile"
28 34 rm "$resultfile"
29 35 }
30 36 trap finish EXIT
31 37
32 for rev in $(hg log -r "$1" -T '{node}\n'); do
38 for rev in $(hg log -r "$revset" -T '{node}\n'); do
33 39 hg log -r "$rev"
34 40 hg update "$rev"
35 41
36 42 cleanup
37 43 python3 -m venv "$venv"
38 44 source "$venv/bin/activate"
39 45 pip install --upgrade pip setuptools
40 46 pip install -e . -r dev_requirements.txt python-ldap python-pam
41 47
42 48 # run-all-cleanup
43 49 if ! scripts/run-all-cleanup ; then
44 50 echo "run-all-cleanup encountered errors!"
45 51 result="NOK"
46 52 else
47 53 if ! hg update --check -q .; then
48 54 echo "run-all-cleanup did not give clean results!"
49 55 result="NOK"
50 56 hg diff
51 57 hg revert -a
52 58 else
53 59 result=" OK"
54 60 fi
55 61 fi
56 62 echo "$result: $rev (run-all-cleanup)" >> "$resultfile"
57 63
58 64 # pytest
59 65 if py.test; then
60 66 result=" OK"
61 67 else
62 68 result="NOK"
63 69 fi
64 70 echo "$result: $rev (pytest)" >> "$resultfile"
65 71
66 72 deactivate
67 73 echo
68 74 done
General Comments 0
You need to be logged in to leave comments. Login now