function parse_svn_branch {
  if [ -d '.svn' ]; then
    ref=$(svn info | grep URL | awk -F/ '{print $NF}' 2> /dev/null) || return
    cur=$(pwd | awk -F/ '{print $NF}' 2> /dev/null) || return
    if [ $ref != $cur ]; then
      echo "#$ref"
    fi
  fi
}

export PS1="\u@\h:\w\[\e[31;40m\]\$(parse_svn_branch)\[\e[0m\] \$ "

svn-prompt.bash hosted by GitHub