Skip to content

Commit bd47bbf

Browse files
committed
Add a script for branch quality control
This script checks whether a branch builds, with passing tests, at every commit not already on the master branch.
1 parent 8696f01 commit bd47bbf

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

check-branch.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#/bin/sh
2+
3+
# check-branch.sh - Iterate over all new commits of a topic branch,
4+
# recording whether the build passes or fails for each.
5+
6+
commits=$@
7+
test "$commits" || commits=$(git rev-list HEAD ^master | tail -r)
8+
9+
branch=$(git rev-parse --abbrev-ref HEAD)
10+
11+
count=0
12+
for commit in $commits
13+
do
14+
git checkout "$commit" > /dev/null 2>&1
15+
mkdir -p tmp
16+
prefix="$(printf %04d $count)"
17+
filename="tmp/$prefix-$commit"
18+
start=$(date +%s)
19+
mvn clean verify > "$filename" 2>&1 && result=SUCCESS || result=FAILURE
20+
end=$(date +%s)
21+
let time="end-start"
22+
echo "$prefix $commit $result $time"
23+
let count="count+1"
24+
done
25+
26+
git checkout "$branch" > /dev/null 2>&1

0 commit comments

Comments
 (0)