Current Git and SVN Branch in Bash Prompt

I thought this was a wonderful idea add it to my own bash prompt.


parse_git_branch() {
  git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)#(git::\1) #'
}
parse_svn_branch() {
  parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print "(svn::"$1 "/" $2 ") "}'
}
parse_svn_url() {
   svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
 parse_svn_repository_root() {
   svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
 }

export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[\033[01;31m\]\$(parse_git_branch)\$(parse_svn_branch)\[\033[00m\]$ "
git svn prompt
git svn prompt



coded by nessus