Created
November 18, 2011 06:47
-
-
Save 10sr/1375783 to your computer and use it in GitHub Desktop.
svnのブランチ名をプロンプトへ ref: http://qiita.com/items/1098
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
| $ __my_svn_ps1 [SVN:%s] |
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
| __my_parse_svn_branch2() { | |
| local LANG=C | |
| local svn_url=$(svn info 2>/dev/null | sed -ne 's#^URL: ##p') | |
| local svn_repository_root=$(svn info 2>/dev/null | sed -ne 's#^Repository Root: ##p') | |
| echo ${svn_url} | sed -e 's#^'"${svn_repository_root}"'##g' | awk '{print $1}' | |
| } | |
| __my_svn_ps1(){ | |
| local svn_branch=$(__my_parse_svn_branch2) | |
| test "${svn_branch}" == "" || echo ${svn_branch} | xargs printf "$1" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment