From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14310 invoked from network); 29 Jan 2022 16:17:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 29 Jan 2022 16:17:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1643473053; b=YwyIkIrFfnPcUe9Dn+2XKwdMQEFRgsebgIsAR87hX7gvVf1US7nrS6i15l8txnMsNW2yDjBuHW 2OvIusEfH7ud/gGcK+FsvW7KMRcQ03tqjR2FT80bbDUiqpctXoUc2aD9u/UmZArXW5GhimiWYq NhLW5dh/i+yLRh9EGjJb/nD1UrlbFIWmpCKkqrkNPRXkGICrUEGWmCy/7FXEfLlH+35VBSxwR6 8FWsZwd/wedtxIwNrAoOcY0XIhqd6bz/o+aDwAXv05kihLdPtaNh9t/GTJXE5KlolIKLV9qQOX hBPQflZ0OxzLK5D5OGGcQbZzkwTcdPmU0trNsHKkWQPr5g==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1643473053; bh=AZ6BLKXfKPGA5s/Jk9JDEYGZfG+ZFYfmXTASNF/lKSo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:To:From:DKIM-Signature:DKIM-Signature:DKIM-Signature; b=SIUwA/GGtvdXxEruyRv49ZIsNn2oDKp+rKkJ41AhhVxrJqWbu9u2yO7ImQm8vMgfe+76tlzSxl 8aXhnvQNqdGuHdbKc1vbiB+H9WE5m/xdx6A992xhohCCx+q03GVs3cS+kLsQIY2BYuIcBRIaO1 zVr4Eq/+il1m6PiqNi01gN9jiUURvBRukRMX0G9iXE1kpUSHce78PIdJ0d+Ys1hZaizDiWIHsb C7NJ51vGyQy6f7Hq3HL1NKbMtxpgRUJRXZj+E44dw8On9o7cxaiSOX01eYT7PYaYSb1Jo31Ndx Wi0WuTAX4VsMkflkFfiHpgHmF4ozAtxsq9fXm10srsrKYw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References; bh=cZwDAq7zbT+2rFPYnvMMGF0JQTxb1SDK+S1VICyVqbg=; b=jpMmKK6F/8hj0KzFgI9yEWTStS IqwHgZvW/gZb+SwxgfpnElx3zgNrRmShph7sXWLfqQ6e8+jILGhYjDE92ogxw/Wb0874Juf5+uj5x moaPiw8/40DZyV/kJdcFVXEILJjN2i5FXCudrU8B86Dttz1tKfN4IeCwzXrEDUhLjx7hsGnc1zvop XiX9uBt7Yv7m0MmPEckgPX19JjvmqaivAYYazZYWvSIdvH1ytY1kIOP61eooUCFFOGsLokBQ1Y+rI Bsjai6NSrsUzcg97E972NOOOiV+FsT4YuX+UqiB/sNGlw3/Fpi0Ii5xta0MV5Je1vUVrGAeQO9Lig S6gzG1+Q==; Received: from authenticated user by zero.zsh.org with local id 1nDqPt-0005R2-Gz; Sat, 29 Jan 2022 16:17:33 +0000 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=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53109) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1nDqNx-0004XX-2c; Sat, 29 Jan 2022 16:15:34 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E39845C0110; Sat, 29 Jan 2022 11:15:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 29 Jan 2022 11:15:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to; s=fm2; bh=cZwDAq7zbT+2rFPYnvMMGF0JQTxb1S DK+S1VICyVqbg=; b=Cr5DqvMIIUcFByU4ui0hrhyEhBt1PSGWqD3tw1uRyW4yPZ bfOFf031In/uhhSh0i1Xd4n1W00yJSG3ukRRwdZzV/ZKFp9YAudolVxOE6Xf3eHe lxCwmlMaUdmpzZAKRS+q21cY/Xqtc7/tbqT7oifaIl8tA0AbguS/p965idz8Wt4R sWLIlaWQqs5nrfb60Cw6LjkHVvMK3II09oyci8hdCGXukGjQxGB5sPVuCXAMMUSg 4Ql3Ge7cPhNXvyyw292c3dMkUW4azTGo2sIwC8LNkq6mFP/sIBDMxzQNM12QBghO 6xDYuhOGiK1eNyJaep68PQQprsKmcqrnhIiF4P7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=cZwDAq7zbT+2rFPYnvMMGF0JQTxb1 SDK+S1VICyVqbg=; b=OG8pGgKARLUamabJIgOoSw4vaZjIJZ7AP/se6kaKOpPly tpHejM077APHBM7nXwF2igSUww0iAeBc2DkBXMhfJecyAmbIp8Mna/UH/Q8cW26k UptpbNX3J0EG7xRo42ljwK/O/axhdzI7yfR/PEwhCFjaMRIQXbAbo7jjnZgRXvT5 CPUgKORB4esa6EInrK5h2o83AW6fBTu0feYUNmrdOqCTUwgGjRGEqHXkP5Mvbj+r RY4oOlonsEFH4T8MxZPrndsTQ8aAL1IfCGjPe+zKgCsr+YN4U5T3TeSHrJSAuTaT hWFRjizmgSbVybvquZn7nu1fyM7QBNm4LE4iF3O3g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfeejgdekkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkedttdertd dtnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgvqeenucggtffrrghtthgvrhhnpeffhfegtedtueekuefhuddvje evfedtkeetjeetvdfhhfegkeevgfevtdelffegfeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrd hnrghmvg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 29 Jan 2022 11:15:31 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1000) id 4JmKDd31mqz4gb; Sat, 29 Jan 2022 16:15:29 +0000 (UTC) From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH 1/3] vcs_info quilt: Pass the patches dir path to the gen-applied-string, gen-unapplied-string, and set-patch-format hooks Date: Sat, 29 Jan 2022 16:15:25 +0000 Message-Id: <20220129161527.17303-1-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Seq: 49727 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: I use that in my gen-applied-string hook. --- This answers my question from workers/49724. Doc/Zsh/contrib.yo | 12 ++++++++++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +- Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 2 +- Functions/VCS_Info/VCS_INFO_quilt | 7 ++++++- Functions/VCS_Info/VCS_INFO_set-patch-format | 8 +++++++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index eb5bbafb2..2cda891ec 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1669,6 +1669,10 @@ available as tt(%p) in the tt(patch-format) and tt(nopatch-format) styles. This hook is, in concert with tt(set-patch-format), responsible for tt(%)-escaping that value for use in the prompt. (See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).) + +The tt(quilt) backend passes to this hook the inputs +tt(${hook_com[quilt-patches-dir]}) and, if it has been +determined, tt(${hook_com[quilt-pc-dir]}). ) item(tt(gen-unapplied-string))( Called in the tt(git) (with tt(stgit) or during rebase), and tt(hg) (with @@ -1687,6 +1691,10 @@ tt(patch-format) and tt(nopatch-format) styles. This hook is, in concert with tt(set-patch-format), responsible for tt(%)-escaping that value for use in the prompt. (See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).) + +The tt(quilt) backend passes to this hook the inputs +tt(${hook_com[quilt-patches-dir]}) and, if it has been +determined, tt(${hook_com[quilt-pc-dir]}). ) item(tt(gen-mqguards-string))( Called in the tt(hg) backend when tt(guards-string) is generated; the @@ -1769,6 +1777,10 @@ This hook is, in concert with the tt(gen-applied-string) or tt(gen-unapplied-string) hooks if they are defined, responsible for tt(%)-escaping the final tt(patch-format) value for use in the prompt. (See ifzman(the bf(Oddities) section)ifnzman(noderef(vcs_info Oddities)).) + +The tt(quilt) backend passes to this hook the inputs +tt(${hook_com[quilt-patches-dir]}) and, if it has been +determined, tt(${hook_com[quilt-pc-dir]}). ) item(tt(set-message))( Called each time before a `tt(vcs_info_msg_)var(N)tt(_)' message is set. diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index fe084dffb..e45eebc8e 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -132,7 +132,7 @@ VCS_INFO_git_handle_patches () { VCS_INFO_set-patch-format 'git_patches_applied' 'git_applied_s' \ 'git_patches_unapplied' 'git_unapplied_s' \ ":vcs_info:${vcs}:${usercontext}:${rrn}" gitmsg \ - '' '' + '' '' '' gitmisc=$REPLY } diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index b123e2270..0041a153c 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -225,7 +225,7 @@ if zstyle -T ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \ VCS_INFO_set-patch-format 'mqpatches' 'applied_string' \ 'mqunapplied' 'unapplied_string' \ ":vcs_info:${vcs}:${usercontext}:${rrn}" hgmqstring \ - extra_hook_com VCS_INFO_hg_extra_zformats + extra_hook_com VCS_INFO_hg_extra_zformats '' hgmqstring=$REPLY fi diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt index ee242f552..ce5b41f24 100644 --- a/Functions/VCS_Info/VCS_INFO_quilt +++ b/Functions/VCS_Info/VCS_INFO_quilt @@ -179,10 +179,15 @@ function VCS_INFO_quilt-patch2subject() { done } + typeset -A quilt_extra_info=( + quilt-patches-dir ${patches} + ${pc:+"quilt-pc-dir"} $pc + ) + VCS_INFO_set-patch-format 'applied' 'applied_string' \ 'unapplied' 'unapplied_string' \ ${context} qstring \ - '' '' + quilt_extra_info '' quilt_extra_info qstring=$REPLY case ${mode} in diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index c35b695c3..1c774a7f6 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -15,6 +15,8 @@ # $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 a function that sets $reply to extra arguments for the patch-format zformat call, or '' for none +# $9 - name of an assoc parameter with extra $hook_com key-value pairs for the +# gen-applied-string & gen-unapplied-string hook invocations, or '' for none # # The expanded patch-format string is returned in $REPLY. # @@ -22,8 +24,10 @@ # - $hook_com is overwritten and the keys 'applied', 'applied-n', # 'unapplied', 'unapplied-n', 'all-n' are set. { + hook_com=() + local applied_needs_escaping='unknown' - local unapplied_needs_escaping='unknown' + hook_com+=( ${9:+"${(@kvP)9}"} ) if VCS_INFO_hook 'gen-applied-string' "${(@P)1}"; then if (( ${(P)#1} )); then REPLY=${(P)1[1]} @@ -37,6 +41,8 @@ : ${(P)2::=$REPLY} hook_com=() + local unapplied_needs_escaping='unknown' + hook_com+=( ${9:+"${(@kvP)9}"} ) if VCS_INFO_hook 'gen-unapplied-string' "${(@P)3}"; then REPLY=${(P)#3} unapplied_needs_escaping='yes'