about summary refs log tree commit diff
path: root/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
diff options
context:
space:
mode:
authorFrank Terbeck <bewater@users.sourceforge.net>2010-05-10 10:46:48 +0000
committerFrank Terbeck <bewater@users.sourceforge.net>2010-05-10 10:46:48 +0000
commit0501efc54af2d194f952c2968a7aeeb5bac8fdf4 (patch)
tree9d632c46950c434594cc46263e35558018912b20 /Functions/VCS_Info/Backends/VCS_INFO_get_data_git
parent144a06bf958b4e573fd3c78eab30536349d09cff (diff)
downloadzsh-0501efc54af2d194f952c2968a7aeeb5bac8fdf4.tar.gz
zsh-0501efc54af2d194f952c2968a7aeeb5bac8fdf4.tar.xz
zsh-0501efc54af2d194f952c2968a7aeeb5bac8fdf4.zip
Seth House, Simon Ruderich and myself: 27948: various vcs_info changes
Here's a diff-stat:

 Doc/Zsh/contrib.yo                                |  506 ++++++++++++++-------
 Functions/VCS_Info/.distfiles                     |    1 +
 Functions/VCS_Info/Backends/VCS_INFO_detect_hg    |   14 +-
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git |   35 +-
 Functions/VCS_Info/Backends/VCS_INFO_get_data_hg  |  295 +++++++++----
 Functions/VCS_Info/VCS_INFO_formats               |   26 +-
 Functions/VCS_Info/VCS_INFO_hook                  |   10 +-
 Functions/VCS_Info/VCS_INFO_quilt                 |  190 ++++++++
 Functions/VCS_Info/vcs_info                       |   30 +-
 Misc/.distfiles                                   |    1 +
 Misc/vcs_info-examples                            |  496 ++++++++++++++++++++
 11 files changed, 1303 insertions(+), 301 deletions(-)

The major changes are vast improvements for the mercurial (hg) backend
(which was done almost entirely by Seth); improved documentation (mostly
done by Simon and again Seth); quilt support (as an addon and stand
alone, see the manual for details); a number of new hooks and a fair
share of bugfixes.
Diffstat (limited to 'Functions/VCS_Info/Backends/VCS_INFO_get_data_git')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_git35
1 files changed, 21 insertions, 14 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 4018b5d92..778d0610b 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -3,7 +3,7 @@
 ## Distributed under the same BSD-ish license as zsh itself.
 
 setopt localoptions extendedglob NO_shwordsplit
-local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1 gitmisc
+local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1
 local stgitpatch stgitunapplied
 local -xA hook_com
 
@@ -139,33 +139,40 @@ if [[ -d $patchdir ]] ; then
     stgit_unapplied=(${(f)"$(< "${patchdir}/unapplied")"})
     stgit_unapplied=( ${(oa)stgit_applied} )
 
-    if VCS_INFO_hook 'gen-stgit-patch-string' "${stgit_applied[@]}"; then
+    if VCS_INFO_hook 'gen-applied-string' "${stgit_applied[@]}"; then
         if (( ${#stgit_applied} )); then
             stgitpatch=${stgit_applied[1]}
         else
-            stgitpatch="no patch applied"
+            stgitpatch=""
         fi
     else
-        stgitpatch=${hook_com[stgit-patch-string]}
+        stgitpatch=${hook_com[patch-string]}
     fi
-    if VCS_INFO_hook 'gen-stgit-unapplied-string' "${stgit_unapplied[@]}"; then
+    hook_com=()
+    if VCS_INFO_hook 'gen-unapplied-string' "${stgit_unapplied[@]}"; then
         stgitunapplied=${#stgit_unapplied}
     else
-        stgitunapplied=${hook_com[stgit-unapplied-string]}
+        stgitunapplied=${hook_com[unapplied-string]}
     fi
 
-    zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" stgitformat stgitmsg || stgitmsg=" %p (%c)"
-    hook_com=( patch "${stgitpatch}" unapplied "${stgitunapplied}" )
-    if VCS_INFO_hook 'set-stgit-format' "${stgitformat}"; then
-        zformat -f stgitmsg "${stgitmsg}" "p:${hook_com[patch]}" "c:${hook_com[unapplied]}"
-        gitmisc=${stgitmsg}
+    if (( ${#stgit_applied} )); then
+        zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" patch-format stgitmsg || stgitmsg="%p (%n applied)"
+    else
+        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} )
+    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}"
     else
-        gitmisc=${hook_com[stgit-replace]}
+        stgitmsg=${hook_com[patch-replace]}
     fi
     hook_com=()
 else
-    gitmisc=''
+    stgitmsg=''
 fi
 
-VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" "${gitsha1}" "${gitmisc}"
+backend_misc[patches]="${stgitmsg}"
+VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" "${gitsha1}" "${stgitmsg}"
 return 0