1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-11-15 21:43:09 +01:00

40403/0003: vcs_info set-patch-format helper: Part #3.

This commit is contained in:
Daniel Shahaf 2017-01-23 18:15:35 +00:00
parent 2702857334
commit edd9798de7
5 changed files with 21 additions and 21 deletions

@ -1,5 +1,11 @@
2017-01-25 Daniel Shahaf <d.s@daniel.shahaf.name>
* 40403/0003: Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
Functions/VCS_Info/VCS_INFO_quilt,
Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info
set-patch-format helper: Part #3.
* 40403/0002: Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
Functions/VCS_Info/VCS_INFO_quilt,

@ -126,13 +126,9 @@ VCS_INFO_git_handle_patches () {
(( git_all = ${#git_patches_applied} + ${#git_patches_unapplied} ))
VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \
'git_patches_unapplied' 'git_unapplied_s'
'git_patches_unapplied' 'git_unapplied_s' \
":vcs_info:${vcs}:${usercontext}:${rrn}" gitmsg
if (( ${#git_patches_applied} )); then
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format gitmsg || gitmsg="%p (%n applied)"
else
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" nopatch-format gitmsg || gitmsg="no patch applied"
fi
hook_com=( applied "${git_applied_s}" unapplied "${git_unapplied_s}"
applied-n ${#git_patches_applied} unapplied-n ${#git_patches_unapplied} all-n ${git_all} )
if VCS_INFO_hook 'set-patch-format' "${gitmsg}"; then

@ -204,21 +204,14 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
fi
VCS_INFO_set-patch-format 'mqpatches' 'applied_string' \
'mqunapplied' 'unapplied_string'
'mqunapplied' 'unapplied_string' \
":vcs_info:${vcs}:${usercontext}:${rrn}" hgmqstring
if VCS_INFO_hook 'gen-mqguards-string' "${mqguards[@]}"; then
guards_string=${(j:,:)mqguards}
else
guards_string=${hook_com[guards-string]}
fi
if (( ${#mqpatches} )); then
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format \
hgmqstring || hgmqstring="%p (%n applied)"
else
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" nopatch-format \
hgmqstring || hgmqstring="no patch applied"
fi
hook_com=( applied "${applied_string}" unapplied "${unapplied_string}"
applied-n ${#mqpatches} unapplied-n ${#mqunapplied} all-n ${#mqseries}
guards "${guards_string}" guards-n ${#mqguards} )

@ -174,13 +174,9 @@ function VCS_INFO_quilt() {
all=( ${(Oa)applied} ${unapplied} )
VCS_INFO_set-patch-format 'applied' 'applied_string' \
'unapplied' 'unapplied_string'
'unapplied' 'unapplied_string' \
${context} qstring
if (( ${#applied} )); then
zstyle -s "${context}" patch-format qstring || qstring="%p (%n applied)"
else
zstyle -s "${context}" nopatch-format qstring || qstring="no patch applied"
fi
hook_com=( applied "${applied_string}" unapplied "${unapplied_string}"
applied-n ${#applied} unapplied-n ${#unapplied} all-n ${#all} )
if VCS_INFO_hook 'set-patch-format' ${qstring}; then

@ -6,6 +6,8 @@
# $2 - name of a parameter to store the applied-string in
# $3 - name of an array parameter to be the argument to gen-unapplied-string
# $4 - name of a parameter to store the unapplied-string in
# $5 - context argument for use in zstyle getters
# $6 - name of a parameter to store a patch-format format string in
{
local REPLY
if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then
@ -27,4 +29,11 @@
fi
: ${(P)4::=$REPLY}
hook_com=()
if (( ${(P)#1} )); then
zstyle -s "${5}" patch-format REPLY || REPLY="%p (%n applied)"
else
zstyle -s "${5}" nopatch-format REPLY || REPLY="no patch applied"
fi
: ${(P)6::=$REPLY}
}