svn-poll-init (540B)
1 #!/bin/bash 2 3 # initialize $URL without getting spammed by backlog 4 # inits to the current revision in an unmuted state 5 6 URL="$1" 7 BASE=$(base64 <<<"$URL" | tr -d '\n') 8 DIR="$HOME/temp/svn-poll/$BASE" 9 FILE="$DIR/rev" 10 ERRORS="$DIR/errors" 11 12 mkdir -p "$DIR" 13 14 LATEST="$(svn info "$URL" | grep Revision | cut -d' ' -f2)" 15 16 # http://stackoverflow.com/a/806923/414272 17 re='^[0-9]+$' 18 if ! [[ $LATEST =~ $re ]] ; then 19 # bail out 20 echo "problem when fetching latest revision: got $LATEST" >&2 21 exit 1 22 fi 23 24 echo "$LATEST" > "$FILE" 25 echo "" > "$ERRORS" 26