blob: 664b4563d2bac39fe565d39b9f240e240812ab6a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# This function is the common guts of the gen-applied-string /
# gen-unapplied-string / set-patch-format dance of several backends.
#
# 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
# $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
if (( ${(P)#1} )); then
REPLY=${(P)1[1]}
else
REPLY=""
fi
else
REPLY=${hook_com[applied-string]}
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=()
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}
}
|