From 3aae0ef8fecd69c983e6452a6b4f9c641cac9ab1 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Fri, 17 Aug 2012 08:22:52 +0000 Subject: Stepan Koltsov: vcs_info: %a to output number of all patches in (no)?patch-format styles --- ChangeLog | 10 +++++++++- 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 +++++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index b870fa618..825b6bb58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2012-08-17 Frank Terbeck + + * Stepan Koltsov: Doc/Zsh/contrib.yo, + Functions/VCS_Info/Backends/VCS_INFO_get_data_git, + Functions/VCS_Info/Backends/VCS_INFO_get_data_hg, + Functions/VCS_Info/VCS_INFO_quilt: vcs_info: %a to output number + of all patches in (no)?patch-format styles + 2012-08-16 Peter Stephenson * Hiramatsu Yoshifumi: 30621 patch-ac (from NetBSD pkgsrc) @@ -70,5 +78,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5698 $ +* $Revision: 1.5699 $ ***************************************************** diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 139a68150..24aafc331 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 9364fd021..e40571a0e 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 a1b87f59e..48e385c97 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 fc127c23b..7001eca07 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 -- cgit 1.4.1