mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-23 04:30:24 +02:00
Stepan Koltsov: vcs_info: %a to output number of all patches in (no)?patch-format styles
This commit is contained in:
parent
402e5fb2ab
commit
3aae0ef8fe
5 changed files with 21 additions and 9 deletions
|
@ -129,12 +129,13 @@ rrn=${gitbase:t}
|
|||
|
||||
local patchdir=${gitdir}/patches/${gitbranch}
|
||||
if [[ -d $patchdir ]] ; then
|
||||
local -a stgit_applied stgit_unapplied
|
||||
local -a stgit_applied stgit_unapplied stgit_all
|
||||
|
||||
stgit_applied=(${(f)"$(< "${patchdir}/applied")"})
|
||||
stgit_applied=( ${(Oa)stgit_applied} )
|
||||
stgit_unapplied=(${(f)"$(< "${patchdir}/unapplied")"})
|
||||
stgit_unapplied=( ${(oa)stgit_unapplied} )
|
||||
stgit_all=( ${(Oa)stgit_applied} ${stgit_unapplied} )
|
||||
|
||||
if VCS_INFO_hook 'gen-applied-string' "${stgit_applied[@]}"; then
|
||||
if (( ${#stgit_applied} )); then
|
||||
|
@ -158,10 +159,10 @@ if [[ -d $patchdir ]] ; then
|
|||
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" nopatch-format stgitmsg || stgitmsg="no patch applied"
|
||||
fi
|
||||
hook_com=( applied "${stgitpatch}" unapplied "${stgitunapplied}"
|
||||
applied-n ${#stgit_applied} unapplied-n ${#stgit_unapplied} )
|
||||
applied-n ${#stgit_applied} unapplied-n ${#stgit_unapplied} all-n ${#stgit_all} )
|
||||
if VCS_INFO_hook 'set-patch-format' "${stgitmsg}"; then
|
||||
zformat -f stgitmsg "${stgitmsg}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
|
||||
"n:${#stgit_applied}" "c:${#stgit_unapplied}"
|
||||
"n:${#stgit_applied}" "c:${#stgit_unapplied}" "a:${#stgit_all}"
|
||||
else
|
||||
stgitmsg=${hook_com[patch-replace]}
|
||||
fi
|
||||
|
|
|
@ -213,13 +213,13 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
|
|||
fi
|
||||
|
||||
hook_com=( applied "${applied_string}" unapplied "${unapplied_string}"
|
||||
applied-n ${#mqpatches} unapplied-n ${#mqunapplied}
|
||||
applied-n ${#mqpatches} unapplied-n ${#mqunapplied} all-n ${#mqseries}
|
||||
guards "${guards_string}" guards-n ${#mqguards} )
|
||||
|
||||
if VCS_INFO_hook 'set-patch-format' ${qstring}; then
|
||||
zformat -f hgmqstring "${hgmqstring}" \
|
||||
"p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
|
||||
"n:${#mqpatches}" "c:${#mqunapplied}" \
|
||||
"n:${#mqpatches}" "c:${#mqunapplied}" "a:${#mqseries}" \
|
||||
"g:${hook_com[guards]}" "G:${#mqguards}"
|
||||
else
|
||||
hgmqstring=${hook_com[patch-replace]}
|
||||
|
|
|
@ -89,7 +89,7 @@ function VCS_INFO_quilt() {
|
|||
local patches pc tmp qstring root
|
||||
local -i ret
|
||||
local -x context
|
||||
local -a applied unapplied applied_string unapplied_string quiltcommand
|
||||
local -a applied unapplied all applied_string unapplied_string quiltcommand
|
||||
local -Ax hook_com
|
||||
|
||||
context=":vcs_info:${vcs}.quilt-${mode}:${usercontext}:${rrn}"
|
||||
|
@ -142,6 +142,8 @@ function VCS_INFO_quilt() {
|
|||
unapplied=()
|
||||
fi
|
||||
|
||||
all=( ${(Oa)applied} ${unapplied} )
|
||||
|
||||
if VCS_INFO_hook 'gen-applied-string' "${applied[@]}"; then
|
||||
if (( ${#applied} )); then
|
||||
applied_string=${applied[1]}
|
||||
|
@ -164,10 +166,10 @@ function VCS_INFO_quilt() {
|
|||
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} )
|
||||
applied-n ${#applied} unapplied-n ${#unapplied} all-n ${#all} )
|
||||
if VCS_INFO_hook 'set-patch-format' ${qstring}; then
|
||||
zformat -f qstring "${qstring}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
|
||||
"n:${#applied}" "c:${#unapplied}"
|
||||
"n:${#applied}" "c:${#unapplied}" "a:${#all}"
|
||||
else
|
||||
qstring=${hook_com[patch-replace]}
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue