aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2016-10-17 10:42:32 +0200
committerKarel Kočí <karel.koci@nic.cz>2016-10-17 10:42:32 +0200
commit42c30f71f4a2d70faa46d87171606da664a877cb (patch)
treea21b4e534d416b13002f5694a52f8bd91832db6c
parent45e121066e841e4c6d895c79269dd41a6e88b5cc (diff)
downloadmyconfigs-42c30f71f4a2d70faa46d87171606da664a877cb.tar.gz
myconfigs-42c30f71f4a2d70faa46d87171606da664a877cb.tar.bz2
myconfigs-42c30f71f4a2d70faa46d87171606da664a877cb.zip
Add simple script to test bunch of commits in project
-rwxr-xr-xlocal/bin/project-test43
1 files changed, 43 insertions, 0 deletions
diff --git a/local/bin/project-test b/local/bin/project-test
new file mode 100755
index 0000000..a0591d8
--- /dev/null
+++ b/local/bin/project-test
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Executes given command on all commits from current one to given one.
+set -e
+
+print_help() {
+ echo "Executes given command for each commit. In default it executes"
+ echo "for 10 previous commands."
+ echo
+ echo "Usage: project-test [OPTION...] [--] COMMAND"
+ echo " -r,--ref [REF]"
+ echo " Git reference to go to"
+ echo " -c,--count [COUNT]"
+ echo " Tests given count of references back from current one."
+}
+
+while [ -n "$1" ]; do
+ case $1 in
+ -r|--ref)
+ shift
+ REF=$1
+ ;;
+ -c|--count)
+ shift
+ REF=HEAD~$1
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ break
+ ;;
+ esac
+ shift
+done
+
+[ -n "$REF" ] || REF=HEAD~10
+
+while read -r rev; do
+ git checkout "$rev"
+ git submodule update
+ eval $@
+done < <(git rev-list "$REF"..HEAD)