Skip to content

Instantly share code, notes, and snippets.

@10sr
Created November 18, 2011 06:47
Show Gist options
  • Select an option

  • Save 10sr/1375783 to your computer and use it in GitHub Desktop.

Select an option

Save 10sr/1375783 to your computer and use it in GitHub Desktop.
svnのブランチ名をプロンプトへ ref: http://qiita.com/items/1098
$ __my_svn_ps1 [SVN:%s]
__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