Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] vcs_info hg: Fix changing the expansion of %g (hook_com[guards]) in the set-patch-format hook (regression from workers/40480).
- X-seq: zsh-workers 47303
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] vcs_info hg: Fix changing the expansion of %g (hook_com[guards]) in the set-patch-format hook (regression from workers/40480).
- Date: Sat, 8 Aug 2020 07:29:34 +0000
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-08/20200808072934.30137-1-danielsh%40tarpaulin.shahaf.local2>
- Authentication-results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm3 header.a=rsa-sha256
- Delivery-date: Sat, 08 Aug 2020 07:37:56 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=from:to:subject:date:message-id :mime-version:content-transfer-encoding; s=fm1; bh=kq/XR0qPSVbQD d6OI7gW56h8RTyFpF0bHXeH/scL5HU=; b=UseV4Ywbf3cFGGVwF6uWYkA7hHjWn xZpzS8rN6eu1TkJLZh7zBR50WKizcjpdGNl7LnNyKV8ufWRytyRA4/dmaLnwWSSP 9BqH38KALzeNFGxg1rZkgerKWbvI1+lfkuzLj1kiyZmhVBNd43/AnnFJtKPlTow+ Lf3WGKYFUkZQMG+ygqIfBnQHo+3ffysMEJabLZbt5M7ZW+SAIYE+DF73sxXQn5hw iGsieg+HkwvntKfP0mQL4x6Kf8FTJ1cCFVC3c1uac95nug/OOFDtaSfY4nhTAaUt YqywWzP7dBk4+devxhqWM4EfVBr0l5//s9mQXcitSl1uKzJevtyLYMgyQ==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=kq/XR0qPSVbQDd6OI 7gW56h8RTyFpF0bHXeH/scL5HU=; b=c+CVIlgi6x7SGJW/fW1MJFru4XuNaaYl7 2IomlV57ShC4FJyi6d6sfV3xhyQXmkCk2lC5Y7RSn88JgJElvQ+bOqkQtHQYHoMP mzTT5+5deIoFmejgK1Yvp6cdcqucknCh2s6nGKFNo/K9rBzEa0TCSfNaWmhXa3lj KSH9vrgbNuw3ZG5GA7sIt+j7ei9JRkiZs2pOeMwKQjPrrxF6JpvvaKE0EJ0jM4RF o5Yl6OoEQYsU7dtbxIeA8tWEqciu+X1JKpK/R38GXkYSQX7fEx0bq0CgsOPWUrrM A4V70D7EskgVV+0FbKGOTrEAxjGKKf2MrnWOIRiXTeg21rSlm6Qzw==
- Envelope-to: archives@xxxxxxxxxxxx
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- Sender: Sympa Owner <sympa@xxxxxxx>
To reproduce, go to a hg repository with active mq guards and configure
vcs_info as follows:
zstyle '*' get-unapplied true
zstyle ':vcs_info:*set-patch-format*' hooks f
zstyle '*' patch-format '[%g : %G]'
zstyle '*' nopatch-format '[%g : %G]'
zstyle '*' formats '%m'
+vi-f () {
hook_com[guards]+=XXX
}
The regression was first released in 5.3.1-test-2, over three years ago.
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 8 ++++++--
Functions/VCS_Info/VCS_INFO_set-patch-format | 6 ++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index 9f61aeaf4..f7e9d6f45 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -217,12 +217,16 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \
fi
local -A extra_hook_com=( guards "${guards_string}" guards-n ${#mqguards} )
- local -a extra_zformats=( "g:${extra_hook_com[guards]}" "G:${#mqguards}" )
+
+ (( ${+functions[VCS_INFO_hg_extra_zformats]} )) ||
+ VCS_INFO_hg_extra_zformats() {
+ reply=( "g:${hook_com[guards]}" "G:${#mqguards}" )
+ }
VCS_INFO_set-patch-format 'mqpatches' 'applied_string' \
'mqunapplied' 'unapplied_string' \
":vcs_info:${vcs}:${usercontext}:${rrn}" hgmqstring \
- extra_hook_com extra_zformats
+ extra_hook_com VCS_INFO_hg_extra_zformats
hgmqstring=$REPLY
fi
diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format
index 917ebf6bf..e387110a2 100644
--- a/Functions/VCS_Info/VCS_INFO_set-patch-format
+++ b/Functions/VCS_Info/VCS_INFO_set-patch-format
@@ -12,7 +12,7 @@
# $6 - name of a parameter to store a patch-format format string in
# $7 - name of an assoc parameter with extra $hook_com key-value pairs for the
# set-patch-format hook invocation, or '' for none
-# $8 - name of an array parameter with extra arguments for the patch-format zformat call, or '' for empty
+# $8 - name of a function that sets $reply to extra arguments for the patch-format zformat call, or '' for none
#
# The expanded patch-format string is returned in $REPLY.
#
@@ -68,10 +68,12 @@
hook_com[unapplied]=${hook_com[unapplied]//'%'/%%}
fi
+ reply=()
+ [[ -n $8 ]] && "$8"
zformat -f REPLY "${(P)6}" "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \
"n:${hook_com[applied-n]}" "c:${hook_com[unapplied-n]}" \
"a:${hook_com[all-n]}" \
- ${8:+"${(@P)8}"}
+ "${reply[@]}"
else
unset applied_needs_escaping unapplied_needs_escaping # the hook deals with escaping
REPLY=${hook_com[patch-replace]}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author