#!/bin/bash # # Usage: svn-latest-tag <SVN-PROJ-URL> # # Prints the latest tag or N/O/N/E if none available. # if [ "x$1" == "x" ]; then echo "Usage: svn-latest-tag <SVN-PROJ-URL>" exit 1 fi # # Tag name to be printed if none found, less likely to be a real tag # name. (directories cannot contain the forward slash, right?) # latest_tag="N/O/N/E" tags=$(svn ls $1/tags) if [ $? -ne 0 ]; then echo $latest_tag exit 1 fi last_rev=$(svn info $1 | grep "Last Changed Rev") if [ $? -ne 0 ]; then echo $latest_tag exit 1 fi # echo $last_rev for tag in $tags; do # echo "Checking tag" $tag if svn info $1/tags/$tag | grep "$last_rev"; then latest_tag=tag break fi done echo $latest_tag