summaryrefslogtreecommitdiff
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
commitedd9798de765049a904e0afa830b191d1932087d (patch)
tree5250e62cc187a569e1b94a6ba7b3dd9df0d1b3ee
parent270285733442a46cd157ade4600e4073e255a563 (diff)
downloadzsh-edd9798de765049a904e0afa830b191d1932087d.tar.gz
zsh-edd9798de765049a904e0afa830b191d1932087d.zip
40403/0003: vcs_info set-patch-format helper: Part #3.
-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-format9
5 files changed, 21 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 7039c4354..8f3c76756 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 974f393cf..4d251497c 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -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
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index 90164fb52..52effa508 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -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} )
diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt
index 1872fc7fa..a81da1c49 100644
--- a/Functions/VCS_Info/VCS_INFO_quilt
+++ b/Functions/VCS_Info/VCS_INFO_quilt
@@ -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
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index 0bbd4742b..664b4563d 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -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}
}