blob: 1a90aa62dec8dc18eaac83d85d4edeabf2d76d81 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
vcs_info () { # {{{
local pat
local -i found
local -a VCSs disabled dps
local -x vcs usercontext
local -ix maxexports
local -ax msgs
local -Ax vcs_comm
vcs="init"
VCSs=(git hg bzr darcs svk mtn svn cvs cdv tla)
case $1 in
(print_systems_)
zstyle -a ":vcs_info:${vcs}:${usercontext}" "disable" disabled
print -l '# list of supported version control backends:' \
'# disabled systems are prefixed by a hash sign (#)'
for vcs in ${VCSs} ; do
[[ -n ${(M)disabled:#${vcs}} ]] && printf '#'
printf '%s\n' ${vcs}
done
print -l '# flavours (cannot be used in the disable style; they' \
'# are disabled with their master [git-svn -> git]):' \
git-{p4,svn}
return 0
;;
('')
[[ -z ${usercontext} ]] && usercontext=default
;;
(*) [[ -z ${usercontext} ]] && usercontext=$1
;;
esac
zstyle -T ":vcs_info:${vcs}:${usercontext}" "enable" || {
[[ -n ${VCS_INFO_message_0_} ]] && VCS_INFO_set --clear
return 0
}
zstyle -a ":vcs_info:${vcs}:${usercontext}" "disable" disabled
zstyle -a ":vcs_info:${vcs}:${usercontext}" "disable-patterns" dps
for pat in ${dps} ; do
if [[ ${PWD} == ${~pat} ]] ; then
[[ -n ${vcs_info_msg_0_} ]] && VCS_INFO_set --clear
return 0
fi
done
VCS_INFO_maxexports
(( found = 0 ))
for vcs in ${VCSs} ; do
[[ -n ${(M)disabled:#${vcs}} ]] && continue
vcs_comm=()
VCS_INFO_${vcs}_detect && (( found = 1 )) && break
done
(( found == 0 )) && {
VCS_INFO_set --nvcs
return 0
}
VCS_INFO_${vcs}_get_data || {
VCS_INFO_set --nvcs
return 1
}
VCS_INFO_set
return 0
}
|