summaryrefslogtreecommitdiff
path: root/Functions/VCS_Info/VCS_INFO_set-patch-format
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-01-23 18:15:35 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-01-25 04:22:32 +0000
commit2854a67e09748a2e6f4e1d8a73bc463bad4cbd4e (patch)
tree6f656b8bb66efa00fe635515f5b98bc5149bd40a /Functions/VCS_Info/VCS_INFO_set-patch-format
parentedd9798de765049a904e0afa830b191d1932087d (diff)
downloadzsh-2854a67e09748a2e6f4e1d8a73bc463bad4cbd4e.tar.gz
zsh-2854a67e09748a2e6f4e1d8a73bc463bad4cbd4e.zip
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.
Diffstat (limited to 'Functions/VCS_Info/VCS_INFO_set-patch-format')
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-patch-format12
1 files changed, 12 insertions, 0 deletions
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]} ))
}