1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-12-18 13:41:56 +00:00

vcs: adding detection of unstaged / staged for svn repos

This commit is contained in:
Ben Hilburn 2016-08-30 20:29:36 -04:00
parent 3b0da2c348
commit 683ca10e36
3 changed files with 15 additions and 8 deletions

View file

@ -69,6 +69,7 @@ case $POWERLEVEL9K_MODE in
VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' #  VCS_REMOTE_BRANCH_ICON ' '$'\UE804 ' # 
VCS_GIT_ICON $'\UE20E ' #  VCS_GIT_ICON $'\UE20E ' # 
VCS_HG_ICON $'\UE1C3 ' #  VCS_HG_ICON $'\UE1C3 ' # 
VCS_SVN_ICON '(svn) '
RUST_ICON '' RUST_ICON ''
PYTHON_ICON $'\U1F40D' # 🐍 PYTHON_ICON $'\U1F40D' # 🐍
) )
@ -122,7 +123,8 @@ case $POWERLEVEL9K_MODE in
VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' #  VCS_REMOTE_BRANCH_ICON ' '$'\UF204 ' # 
VCS_GIT_ICON $'\UF113 ' #  VCS_GIT_ICON $'\UF113 ' # 
VCS_HG_ICON $'\UF0C3 ' #  VCS_HG_ICON $'\UF0C3 ' # 
RUST_ICON $'\UE6A8' #  VCS_SVN_ICON '(svn) '
RUST_ICON $'\UE6A8' # 
PYTHON_ICON $'\U1F40D' # 🐍 PYTHON_ICON $'\U1F40D' # 🐍
) )
;; ;;
@ -175,7 +177,8 @@ case $POWERLEVEL9K_MODE in
VCS_REMOTE_BRANCH_ICON $'\u2192' # → VCS_REMOTE_BRANCH_ICON $'\u2192' # →
VCS_GIT_ICON '' VCS_GIT_ICON ''
VCS_HG_ICON '' VCS_HG_ICON ''
RUST_ICON '' VCS_SVN_ICON ''
RUST_ICON ''
PYTHON_ICON '' PYTHON_ICON ''
) )
;; ;;

View file

@ -113,8 +113,8 @@ function +vi-vcs-detect-changes() {
vcs_visual_identifier='VCS_GIT_ICON' vcs_visual_identifier='VCS_GIT_ICON'
elif [[ "${hook_com[vcs]}" == "hg" ]]; then elif [[ "${hook_com[vcs]}" == "hg" ]]; then
vcs_visual_identifier='VCS_HG_ICON' vcs_visual_identifier='VCS_HG_ICON'
# elif [[ "${hook_com[vcs]}" == "svn" ]]; then elif [[ "${hook_com[vcs]}" == "svn" ]]; then
# vcs_visual_identifier='VCS_SVN_ICON' vcs_visual_identifier='VCS_SVN_ICON'
fi fi
if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then if [[ -n "${hook_com[staged]}" ]] || [[ -n "${hook_com[unstaged]}" ]]; then
@ -127,11 +127,15 @@ function +vi-vcs-detect-changes() {
function +vi-svn-detect-changes() { function +vi-svn-detect-changes() {
local svn_status=$(svn status) local svn_status=$(svn status)
if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then if [[ -n "$(echo "$svn_status" | grep \^\?)" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_STASH_ICON')" hook_com[unstaged]+=" $(print_icon 'VCS_UNTRACKED_ICON')"
VCS_WORKDIR_HALF_DIRTY=true VCS_WORKDIR_HALF_DIRTY=true
fi fi
if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then if [[ -n "$(echo "$svn_status" | grep \^\M)" ]]; then
hook_com[unstaged]+=" $(print_icon 'VCS_UNSTAGED_ICON')"
VCS_WORKDIR_DIRTY=true
fi
if [[ -n "$(echo "$svn_status" | grep \^\A)" ]]; then
hook_com[staged]+=" $(print_icon 'VCS_STAGED_ICON')"
VCS_WORKDIR_DIRTY=true VCS_WORKDIR_DIRTY=true
hook_com[unstaged]+=" $(print_icon 'VCS_STAGED_ICON')"
fi fi
} }

View file

@ -876,7 +876,7 @@ prompt_vcs() {
zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS zstyle ':vcs_info:git*+set-message:*' hooks $POWERLEVEL9K_VCS_GIT_HOOKS
defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes) defined POWERLEVEL9K_VCS_HG_HOOKS || POWERLEVEL9K_VCS_HG_HOOKS=(vcs-detect-changes)
zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS zstyle ':vcs_info:hg*+set-message:*' hooks $POWERLEVEL9K_VCS_HG_HOOKS
defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(svn-detect-changes) defined POWERLEVEL9K_VCS_SVN_HOOKS || POWERLEVEL9K_VCS_SVN_HOOKS=(vcs-detect-changes svn-detect-changes)
zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS zstyle ':vcs_info:svn*+set-message:*' hooks $POWERLEVEL9K_VCS_SVN_HOOKS
# For Hg, only show the branch name # For Hg, only show the branch name