From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19568 invoked by alias); 17 Aug 2012 04:00:09 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30624 Received: (qmail 4983 invoked from network); 17 Aug 2012 03:59:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at mx1.ru does not designate permitted sender hosts) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :x-gm-message-state; bh=Hp+LTuzoAa/ZzmQQZKiN/LmIdqvLaIqLr2xFHQbPhVI=; b=BvMxSrkaUHfQyCRbNfFjO/Rv59a6NRkQYrVLdqrt0X+mLTuIpy/anCVlzNAlbGVYNW 7T0XT7fDSHbTZ5dYJlUSzrdyVHmYMXLMeQvh7FLvT5cF1DJm7WB9V0viRfVWExLpMtCi kseHovHwZkVJIEWZH+K2Xe57HYgC/Ac/OUKZHcA+F9Txj8d5vMu9hQT6BhUB4Pz8cLrU WmG0KIkZNY2XRf0a84eTS6mW1y0zBYDejxB+b1oZlDidQbJd2bRSi8ugJLb2jvdfq8mx q/1inVyXbyyCLk7eY8keVyDScC4//6VaxDOQng8JAyZM6B26pFS712JzgZBbB3I2Iind 9xaA== MIME-Version: 1.0 Sender: stepancheg@mx1.ru In-Reply-To: References: Date: Fri, 17 Aug 2012 07:59:50 +0400 X-Google-Sender-Auth: Csiw50rKj-_3GayoKG0xEhQKi6k Message-ID: Subject: Re: [PATCH] vcs_info: %a to output number of all patches in (no)?patch-format styles From: Stepan Koltsov To: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlVkZ3Ur7Xf6tZDutYsJSBdZAW0ToT2aJdxbTaU9gWBBo3m2tbzhBv+syzrcNHY8mpBDvFP Seems like GMail split long lines in patch. This patch on github: https://github.com/stepancheg/zsh/commit/1fdb41aba960fe0ef362cd6863c1e91b8e28dd40 Raw patch: https://github.com/stepancheg/zsh/commit/1fdb41aba960fe0ef362cd6863c1e91b8e28dd40.patch -- Stepan Koltsov On Fri, Aug 17, 2012 at 7:12 AM, Stepan Koltsov wrote: > To generate string like "patch 1 of 4". > > Implemented for all of mq, stgit and quilt. > --- > Doc/Zsh/contrib.yo | 1 + > Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 7 ++++--- > Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 4 ++-- > Functions/VCS_Info/VCS_INFO_quilt | 8 +++++--- > 4 files changed, 12 insertions(+), 8 deletions(-) > > diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo > index 139a681..24aafc3 100644 > --- a/Doc/Zsh/contrib.yo > +++ b/Doc/Zsh/contrib.yo > @@ -1003,6 +1003,7 @@ sitem(tt(%p))(The name of the top-most applied > patch (tt(applied-string)).) > sitem(tt(%u))(The number of unapplied patches (tt(unapplied-string)).) > sitem(tt(%n))(The number of applied patches.) > sitem(tt(%c))(The number of unapplied patches.) > +sitem(tt(%a))(The number of all patches.) > sitem(tt(%g))(The names of active tt(mq) guards (tt(hg) backend).) > sitem(tt(%G))(The number of active tt(mq) guards (tt(hg) backend).) > endsitem() > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > index 9364fd0..e40571a 100644 > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git > @@ -129,12 +129,13 @@ rrn=${gitbase:t} > > local patchdir=${gitdir}/patches/${gitbranch} > if [[ -d $patchdir ]] ; then > - local -a stgit_applied stgit_unapplied > + local -a stgit_applied stgit_unapplied stgit_all > > stgit_applied=(${(f)"$(< "${patchdir}/applied")"}) > stgit_applied=( ${(Oa)stgit_applied} ) > stgit_unapplied=(${(f)"$(< "${patchdir}/unapplied")"}) > stgit_unapplied=( ${(oa)stgit_unapplied} ) > + stgit_all=( ${(Oa)stgit_applied} ${stgit_unapplied} ) > > if VCS_INFO_hook 'gen-applied-string' "${stgit_applied[@]}"; then > if (( ${#stgit_applied} )); then > @@ -158,10 +159,10 @@ if [[ -d $patchdir ]] ; then > zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" > nopatch-format stgitmsg || stgitmsg="no patch applied" > fi > hook_com=( applied "${stgitpatch}" unapplied "${stgitunapplied}" > - applied-n ${#stgit_applied} unapplied-n ${#stgit_unapplied} ) > + applied-n ${#stgit_applied} unapplied-n > ${#stgit_unapplied} all-n ${#stgit_all} ) > if VCS_INFO_hook 'set-patch-format' "${stgitmsg}"; then > zformat -f stgitmsg "${stgitmsg}" "p:${hook_com[applied]}" > "u:${hook_com[unapplied]}" \ > - "n:${#stgit_applied}" > "c:${#stgit_unapplied}" > + "n:${#stgit_applied}" > "c:${#stgit_unapplied}" "a:${#stgit_all}" > else > stgitmsg=${hook_com[patch-replace]} > fi > diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > index a1b87f5..48e385c 100644 > --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg > @@ -213,13 +213,13 @@ if zstyle -T > ":vcs_info:${vcs}:${usercontext}:${rrn}" get-mq \ > fi > > hook_com=( applied "${applied_string}" unapplied "${unapplied_string}" > - applied-n ${#mqpatches} unapplied-n ${#mqunapplied} > + applied-n ${#mqpatches} unapplied-n > ${#mqunapplied} all-n ${#mqseries} > guards "${guards_string}" guards-n ${#mqguards} ) > > if VCS_INFO_hook 'set-patch-format' ${qstring}; then > zformat -f hgmqstring "${hgmqstring}" \ > "p:${hook_com[applied]}" "u:${hook_com[unapplied]}" \ > - "n:${#mqpatches}" "c:${#mqunapplied}" \ > + "n:${#mqpatches}" "c:${#mqunapplied}" "a:${#mqseries}" \ > "g:${hook_com[guards]}" "G:${#mqguards}" > else > hgmqstring=${hook_com[patch-replace]} > diff --git a/Functions/VCS_Info/VCS_INFO_quilt > b/Functions/VCS_Info/VCS_INFO_quilt > index fc127c2..7001eca 100644 > --- a/Functions/VCS_Info/VCS_INFO_quilt > +++ b/Functions/VCS_Info/VCS_INFO_quilt > @@ -89,7 +89,7 @@ function VCS_INFO_quilt() { > local patches pc tmp qstring root > local -i ret > local -x context > - local -a applied unapplied applied_string unapplied_string quiltcommand > + local -a applied unapplied all applied_string unapplied_string quiltcommand > local -Ax hook_com > > context=":vcs_info:${vcs}.quilt-${mode}:${usercontext}:${rrn}" > @@ -142,6 +142,8 @@ function VCS_INFO_quilt() { > unapplied=() > fi > > + all=( ${(Oa)applied} ${unapplied} ) > + > if VCS_INFO_hook 'gen-applied-string' "${applied[@]}"; then > if (( ${#applied} )); then > applied_string=${applied[1]} > @@ -164,10 +166,10 @@ function VCS_INFO_quilt() { > 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} ) > + applied-n ${#applied} unapplied-n ${#unapplied} > all-n ${#all} ) > if VCS_INFO_hook 'set-patch-format' ${qstring}; then > zformat -f qstring "${qstring}" "p:${hook_com[applied]}" > "u:${hook_com[unapplied]}" \ > - "n:${#applied}" "c:${#unapplied}" > + "n:${#applied}" > "c:${#unapplied}" "a:${#all}" > else > qstring=${hook_com[patch-replace]} > fi > -- > 1.7.9.6 (Apple Git-31.1)