Last active
December 15, 2015 04:59
-
-
Save hinerm/5205643 to your computer and use it in GitHub Desktop.
Script for finding valid commits on a git branch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# History checking script | |
# | |
# This script checks out each commit that | |
# exists on a dev_branch but not a base_branch. | |
# "ant clean tools" is run on that branch, | |
# and a log file is written with the results | |
# of the build to | |
# <log_dir>/<PASSED/FAILED><commit hash><commit message>.log | |
# depending on if the build passed or failed. | |
# | |
# Inputs: | |
# base_branch - the branch whose commits should not be checked | |
# dev_branch - the branch with commits to check | |
# log_dir - where to write the logs | |
# path to bioformats - where bioformats was checked out | |
mkdir -p $3 | |
cd $3 | |
rm *.log | |
cd - | |
cd $4 | |
list=$(git cherry -v $1 $2 | cut -d ' ' -f 2) | |
failed=" FAILED_" | |
passed=" PASSED_" | |
for item in $list | |
do | |
git checkout $item | |
item=$item'_'$(git log -1 --format=%s | sed 's/\///') | |
output=$(ant clean tools 2>/dev/null) | |
success=$? | |
time=$(date +%j:%H:%M:%S) | |
if [[ $success -ne 0 ]] | |
then | |
#build failed | |
echo "$output" > "../$3/$time$failed$item.log" | |
else | |
#build passed | |
echo "$output" > "../$3/$time$passed$item.log" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment