From 2854a67e09748a2e6f4e1d8a73bc463bad4cbd4e Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 23 Jan 2017 18:15:35 +0000 Subject: 40403/0004: vcs_info set-patch-format helper: Part #4. This also fixes the %a (${hook_com[all-n]}) expando in the hg backend: before this change, it counted only unapplied changes. --- Functions/VCS_Info/VCS_INFO_set-patch-format | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format') diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index 664b4563d..84febabd9 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -8,6 +8,10 @@ # $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 +# +# Output: +# - $hook_com is overwritten and the keys 'applied', 'applied-n', +# 'unapplied', 'unapplied-n', 'all-n' are set. { local REPLY if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then @@ -36,4 +40,12 @@ zstyle -s "${5}" nopatch-format REPLY || REPLY="no patch applied" fi : ${(P)6::=$REPLY} + + hook_com=( + applied-n ${(P)#1} + applied ${(P)2} + unapplied-n ${(P)#3} + unapplied ${(P)4} + ) + hook_com[all-n]=$(( ${hook_com[applied-n]} + ${hook_com[unapplied-n]} )) } -- cgit v1.2.3