Created
February 26, 2014 12:20
-
-
Save larsvegas/9228551 to your computer and use it in GitHub Desktop.
bash-git-svn-branch-status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Prompt | |
## repository highlights and prompt | |
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/(git:\1$(parse_git_dirty))/" | |
} | |
parse_svn_branch() { | |
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print "(svn:"$1 $3 "/"$4 "/"$5 ")"}' | |
} | |
parse_svn_url() { | |
svn info 2>/dev/null | grep -e '^URL*' | sed -e 's#^URL: *\(.*\)#\1#g' | |
} | |
parse_svn_repository_root() { | |
svn info 2>/dev/null | grep -e '^Basis des Projektarchivs: *' | sed -e 's#^Basis des Projectarchives: *\(.*\)#\1\/#g ' | |
} | |
#parse_web_environment() { | |
#} | |
## export prompt | |
export PS1="\[\033[00m\]\u@\h\[\033[1;34m\] \$(date +'%m-%d %H:%M:%S') \[\033[00m\]\[\033[4;36m\]\w\[\033[0;31m\] \$(parse_git_branch)\$(parse_svn_branch) \[\033[00m\]$\[\033[00m\] " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment