summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git8
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_hg11
-rw-r--r--Functions/VCS_Info/VCS_INFO_quilt8
-rw-r--r--Functions/VCS_Info/VCS_INFO_set-patch-format10
5 files changed, 22 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index ad4b22029..7039c4354 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2017-01-25 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 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,
+ Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info
+ set-patch-format helper: Part #2.
+
* 40403/0001: Functions/VCS_Info/Backends/VCS_INFO_get_data_git,
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg,
Functions/VCS_Info/VCS_INFO_quilt,
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 9e0749cf5..974f393cf 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -125,12 +125,8 @@ VCS_INFO_git_handle_patches () {
git_patches_unapplied=(${(Oa)git_patches_unapplied})
(( git_all = ${#git_patches_applied} + ${#git_patches_unapplied} ))
- VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s'
- if VCS_INFO_hook 'gen-unapplied-string' "${git_patches_unapplied[@]}"; then
- git_unapplied_s=${#git_patches_unapplied}
- else
- git_unapplied_s=${hook_com[unapplied-string]}
- fi
+ VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \
+ 'git_patches_unapplied' 'git_unapplied_s'
if (( ${#git_patches_applied} )); then
zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format gitmsg || gitmsg="%p (%n applied)"
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index 19bec7af1..90164fb52 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -203,15 +203,8 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
done < ${mqseriesfile}
fi
- VCS_INFO_set-patch-format 'mqpatches' 'applied_string'
- if VCS_INFO_hook 'gen-unapplied-string' "${mqunapplied[@]}"; then
- unapplied_string=${#mqunapplied}
- else
- unapplied_string=${hook_com[unapplied-string]}
- fi
-
- hook_com=()
-
+ VCS_INFO_set-patch-format 'mqpatches' 'applied_string' \
+ 'mqunapplied' 'unapplied_string'
if VCS_INFO_hook 'gen-mqguards-string' "${mqguards[@]}"; then
guards_string=${(j:,:)mqguards}
else
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index dd3f4959b..1872fc7fa 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -173,12 +173,8 @@ function VCS_INFO_quilt() {
all=( ${(Oa)applied} ${unapplied} )
- VCS_INFO_set-patch-format 'applied' 'applied_string'
- if VCS_INFO_hook 'gen-unapplied-string' "${unapplied[@]}"; then
- unapplied_string="${#unapplied}"
- else
- unapplied_string=${hook_com[unapplied-string]}
- fi
+ VCS_INFO_set-patch-format 'applied' 'applied_string' \
+ 'unapplied' 'unapplied_string'
if (( ${#applied} )); then
zstyle -s "${context}" patch-format qstring || qstring="%p (%n applied)"
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index 310df9625..0bbd4742b 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -4,6 +4,8 @@
# Parameters:
# $1 - name of an array parameter to be the argument to gen-applied-string
# $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
{
local REPLY
if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then
@@ -17,4 +19,12 @@
fi
: ${(P)2::=$REPLY}
hook_com=()
+
+ if VCS_INFO_hook 'gen-unapplied-string' "${(@P)3}"; then
+ REPLY=${(P)#3}
+ else
+ REPLY=${hook_com[unapplied-string]}
+ fi
+ : ${(P)4::=$REPLY}
+ hook_com=()
}