History
yesterday i came across this bash script (http://hocuspokus.net/2009/07/add-git-and-svn-branch-to-bash-prompt) then while eating a couple scramble eggs at 4 am i thought that i would be a little bit nicer if i could include the SVN revision number to the script, i took me a couple hours to get it done (sed/awk biatches!) but i did it on the end
How does it work
just enter to any checkout of SVN or a clone of any GIT project, and your prompt will indicate the type of version control and the current branch and also the current revision number (revision will be only on the SVN info)
Git

SVN

Download/Source
download the file from the oziputils github project
http://github.com/ozipi/oziputils
or just grab whatever the functions and the PS1 export from the source and put it on your .profile file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| #Colors definition
BLACK="\[\033[0;30m\]"
DARK_GRAY="\[\033[1;30m\]"
LIGHT_GRAY="\[\033[0;37m\]"
BLUE="\[\033[0;34m\]"
LIGHT_BLUE="\[\033[1;34m\]"
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
CYAN="\[\033[0;36m\]"
LIGHT_CYAN="\[\033[1;36m\]"
RED="\[\033[0;31m\]"
LIGHT_RED="\[\033[1;31m\]"
PURPLE="\[\033[0;35m\]"
LIGHT_PURPLE="\[\033[1;35m\]"
BROWN="\[\033[0;33m\]"
YELLOW="\[\033[1;33m\]"
WHITE="\[\033[1;37m\]"
DEFAULT_COLOR="\[\033[00m\]"
RED_BOLD="\[\033[01;31m\]"
GREEN="\[\033[0;32m\]"
#Get git information
parse_git_branch () {
git name-rev HEAD 2> /dev/null | sed 's#HEAD\ \(.*\)# (git::\1)#'
}
#Get svn information
##Get svn url
parse_svn_url() {
svn info 2>/dev/null | sed -ne 's#^URL: ##p'
}
##Get svn repository root
parse_svn_repository_root() {
svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p'
}
##Get svn revision
parse_svn_current_revision() {
svn info 2>/dev/null | sed -ne 's#^Revision: ##p'
}
##Parse everything and return the svn general info
parse_svn_branch_revision() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print $1 "/" $2 }' | awk '{print " (svn::_@" $1 ")" } ' | sed -e 's#_@#'"$(parse_svn_current_revision)"':#g'
}
export PS1="$DEFAULT_COLOR[$LIGHT_CYAN\u@\h$BLUE $YELLOW\w$LIGHT_PURPLE\$(parse_git_branch)\$(parse_svn_branch_revision)$DEFAULT_COLOR ] " |
Thanks to @dazoakley for the script and let’s hope somebody found this useful
Mataii 3:36 pm on December 8, 2009 Permalink
A little bit difficult to me at this time =/, yeah.. I used to play this game with my brother and sister, over 20 years ago (Atari I think) fun times indeed.. : )
Looks nice your “paper invaders” version
, so what’s next?
ozipi 3:43 pm on December 8, 2009 Permalink
the next version its a surprise surprise : )
i didn’t know that you had an atari! :OO
Mataii 3:53 pm on December 8, 2009 Permalink
Yes, I had one console Atari… the wonder years
alfo 4:50 am on December 9, 2009 Permalink
tiene mundos secretos ? jala el arriba arrib abajo abajo ?? jajajajaja
nice skin…. muy chido muy chido…. escucho el “plac plac” de pacman por ahi ??
mikeroguez 4:26 pm on December 14, 2009 Permalink
Hey ozipi!!! simply amazing, when I´ll grow up… wanna be just like you!
Suss 6:35 pm on December 16, 2009 Permalink
yujuuu es mas rapido que la pasada version =D chido chido… aun asi pierdo u_u