X-Git-Url: https://git.madduck.net/etc/zsh.git/blobdiff_plain/2f58f5d883f04e62b6d8869c0c3a14ba785371df..0a03dffac6c1304d4bf57f54bbd0c36ea1e337c8:/.zsh/zshrc/85_vcs_prompt diff --git a/.zsh/zshrc/85_vcs_prompt b/.zsh/zshrc/85_vcs_prompt index e96b772..a99ca18 100644 --- a/.zsh/zshrc/85_vcs_prompt +++ b/.zsh/zshrc/85_vcs_prompt @@ -31,6 +31,38 @@ __git_get_branch() echo "${ref#refs/heads/}" } +__hg_get_reporoot() +{ + hg root +} + +__hg_get_branch() +{ + echo "hg:$(hg branch)" +} + +__bzr_get_reporoot() +{ + local reporoot + reporoot="$(bzr info | sed -rne 's, *branch root: ,,p')" + case "$reporoot" in + .) echo "$PWD";; + *) echo "$reporoot";; + esac +} + +__bzr_get_branch() +{ + local branch revno + bzr version-info | while read i j; do + case "$i" in + revno:) revno="$j";; + branch-nick:) branch="$j";; + esac + done + echo "bzr:${branch}@$revno" +} + __vcs_get_repo_type() { # return the type of the closest repository in the path hierarchy @@ -39,9 +71,6 @@ __vcs_get_repo_type() [ -d ${dir}.git ] && echo git && break [ -d ${dir}.bzr ] && echo bzr && break [ -d ${dir}.hg ] && echo hg && break - [ -d ${dir}.svn ] && echo svn && break - [ -d ${dir}.svk ] && echo svk && break - [ -d ${dir}CVS ] && echo cvs && break [ "$(readlink -f ${dir:-.})" = / ] && echo NONE && break dir="../$dir" done @@ -115,6 +144,18 @@ __vcs_set_prompt_variables() branch="$(__git_get_branch)" || { error "could not determine git branch"; return 1 } ;; + hg) + reporoot="$(__hg_get_reporoot)" || + { error "could not determine hg repository root"; return 1 } + branch="$(__hg_get_branch)" || + { error "could not determine hg branch"; return 1 } + ;; + bzr) + reporoot="$(__bzr_get_reporoot)" || + { error "could not determine bzr repository root"; return 1 } + branch="$(__bzr_get_branch)" || + { error "could not determine bzr branch"; return 1 } + ;; *) case "$repotype" in NONE) :;;