diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-04-06 19:19:08 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-04-06 19:19:08 +0000 |
commit | 8dd8067f13e5aaf2fc740748b0afeca00b1ea424 (patch) | |
tree | 0d189361f983668aebbf590cc8e7bd9ec24b0b6b /Functions/VCS_Info | |
parent | b148a56869958ee691c57ddaf633a8a4e038b3dc (diff) | |
download | zsh-8dd8067f13e5aaf2fc740748b0afeca00b1ea424.tar.gz zsh-8dd8067f13e5aaf2fc740748b0afeca00b1ea424.tar.xz zsh-8dd8067f13e5aaf2fc740748b0afeca00b1ea424.zip |
Frank Terbeck: 26816 to 26820: VCS_Info updates
Diffstat (limited to 'Functions/VCS_Info')
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 17 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_svk | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/Backends/VCS_INFO_get_data_tla | 2 | ||||
-rw-r--r-- | Functions/VCS_Info/VCS_INFO_formats | 21 |
12 files changed, 43 insertions, 15 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr index 1030c06ab..e85de311e 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr @@ -22,5 +22,5 @@ fi rrn=${bzrbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat bzrbr || bzrbr="%b:%r" zformat -f bzrbr "${bzrbr}" "b:${bzrinfo[2]}" "r:${bzrinfo[1]}" -VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' '' +VCS_INFO_formats '' "${bzrbr}" "${bzrbase}" '' '' "${bzrinfo[1]}" '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv index 2c516ea4b..4f8118489 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv @@ -7,5 +7,5 @@ local cdvbase cdvbase=${vcs_comm[basedir]} rrn=${cdvbase:t} -VCS_INFO_formats '' "${cdvbase:t}" "${cdvbase}" '' '' +VCS_INFO_formats '' "${cdvbase:t}" "${cdvbase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs index 1c222ceec..ed738b98f 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs @@ -14,5 +14,5 @@ cvsbranch=$(< ./CVS/Repository) rrn=${cvsbase:t} cvsbranch=${cvsbranch##${rrn}/} [[ -z ${cvsbranch} ]] && cvsbranch=${rrn} -VCS_INFO_formats '' "${cvsbranch}" "${cvsbase}" '' '' +VCS_INFO_formats '' "${cvsbranch}" "${cvsbase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs b/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs index a1ebbb6ea..3f6a22646 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_darcs @@ -7,5 +7,5 @@ local darcsbase darcsbase=${vcs_comm[basedir]} rrn=${darcsbase:t} -VCS_INFO_formats '' "${darcsbase:t}" "${darcsbase}" '' '' +VCS_INFO_formats '' "${darcsbase:t}" "${darcsbase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 75d39cc4a..faab2b88a 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 +local gitdir gitbase gitbranch gitaction gitunstaged gitstaged gitsha1 VCS_INFO_git_getaction () { local gitaction='' gitdir=$1 @@ -77,7 +77,7 @@ VCS_INFO_git_getbranch () { gitbranch="$(${(z)gitsymref} 2> /dev/null)" if [[ $? -ne 0 ]] ; then - gitbranch="$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)" + gitbranch="refs/tags/$(${vcs_comm[cmd]} describe --exact-match HEAD 2>/dev/null)" if [[ $? -ne 0 ]] ; then gitbranch="${${"$(< $gitdir/HEAD)"}[1,7]}..." @@ -85,12 +85,21 @@ VCS_INFO_git_getbranch () { fi fi - printf '%s' "${gitbranch##refs/heads/}" + printf '%s' "${gitbranch}" return 0 } gitdir=${vcs_comm[gitdir]} gitbranch="$(VCS_INFO_git_getbranch ${gitdir})" +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision && \ + [[ ${gitbranch} == refs/* ]] && \ + [[ -r "${gitdir}/${gitbranch}" ]] ; then + + gitsha1="${"$(< $gitdir/$gitbranch)"}" +else + gitsha1='' +fi +gitbranch="${gitbranch##refs/[^/]##/}" if [[ -z ${gitdir} ]] || [[ -z ${gitbranch} ]] ; then return 1 @@ -108,5 +117,5 @@ VCS_INFO_adjust gitaction="$(VCS_INFO_git_getaction ${gitdir})" gitbase=${PWD%/${$( ${vcs_comm[cmd]} rev-parse --show-prefix )%/##}} rrn=${gitbase:t} -VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" +VCS_INFO_formats "${gitaction}" "${gitbranch}" "${gitbase}" "${gitstaged}" "${gitunstaged}" "${gitsha1}" '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index fb7c45087..d70e03c00 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -8,5 +8,5 @@ local hgbranch hgbase hgbase=${vcs_comm[basedir]} rrn=${hgbase:t} hgbranch=$(< ${hgbase}/.hg/branch) -VCS_INFO_formats '' "${hgbranch}" "${hgbase}" '' '' +VCS_INFO_formats '' "${hgbranch}" "${hgbase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn index 63f060163..0a8064c36 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn @@ -8,5 +8,5 @@ local mtnbranch mtnbase mtnbase=${vcs_comm[basedir]} rrn=${mtnbase:t} mtnbranch=${${(M)${(f)"$( ${vcs_comm[cmd]} status )"}:#(#s)Current branch:*}/*: /} -VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}" '' '' +VCS_INFO_formats '' "${mtnbranch}" "${mtnbase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 index ac87fafe5..e4bbb06c4 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 @@ -21,4 +21,4 @@ p4branch="%b:%r" zformat -f p4branch "${p4branch}" "b:${p4info[Client_name]}" \ "r:$change" -VCS_INFO_formats '' "${p4branch}" "${p4base}" '' '' +VCS_INFO_formats '' "${p4branch}" "${p4base}" '' '' "$change" '' diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk index 48e5edb2c..29cda818c 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svk @@ -9,5 +9,5 @@ svkbase=${vcs_comm[basedir]} rrn=${svkbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svkbranch || svkbranch="%b:%r" zformat -f svkbranch "${svkbranch}" "b:${vcs_comm[branch]}" "r:${vcs_comm[revision]}" -VCS_INFO_formats '' "${svkbranch}" "${svkbase}" '' '' +VCS_INFO_formats '' "${svkbranch}" "${svkbase}" '' '' "${${vcs_comm[revision]}" '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index e18080585..75da22bda 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -24,5 +24,5 @@ svnbase="$(VCS_INFO_realpath ${svnbase})" rrn=${svnbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r" zformat -f svnbranch "${svnbranch}" "b:${svninfo[URL]##*/}" "r:${svninfo[Revision]}" -VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' +VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${svninfo[Revision]}" '' return 0 diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla index 69a82eb19..f015e0cce 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_tla @@ -9,5 +9,5 @@ tlabase="$(VCS_INFO_realpath ${vcs_comm[basedir]})" rrn=${tlabase:t} # tree-id gives us something like 'foo@example.com/demo--1.0--patch-4', so: tlabranch=${${"$( ${vcs_comm[cmd]} tree-id )"}/*\//} -VCS_INFO_formats '' "${tlabranch}" "${tlabase}" '' '' +VCS_INFO_formats '' "${tlabranch}" "${tlabase}" '' '' '' '' return 0 diff --git a/Functions/VCS_Info/VCS_INFO_formats b/Functions/VCS_Info/VCS_INFO_formats index 72030ccdc..35b3b963d 100644 --- a/Functions/VCS_Info/VCS_INFO_formats +++ b/Functions/VCS_Info/VCS_INFO_formats @@ -3,7 +3,24 @@ ## Distributed under the same BSD-ish license as zsh itself. setopt localoptions noksharrays NO_shwordsplit -local action=$1 branch=$2 base=$3 staged=$4 unstaged=$5 +local action=$1 branch=$2 base=$3 staged=$4 unstaged=$5 rev=$6 misc=$7 + +## description: +# action: a string that signals a certain non-default condition in the +# repository (like 'rebase-i' in git). If this in non-empty, +# the actionformats will be used, too. +# branch: the name of the currently checked out branch. +# base: the full name of the repository's root directory. +# staged: non-empty if the repository contains staged changes. +# unstaged: non-empty if the repository contains unstaged changes. +# rev: an identifier of the currently checked out revision. +# misc: a string that may contain anything the author likes. +# the backends should document what they put in it and when. +# +# If an argument has no valid value for a given backend, an empty value +# should be provided. eg: +# VCS_INFO_formats '' "${foobranch}" "${foobase}" '' '' '' "${foomisc}" + local msg local -i i j @@ -31,6 +48,8 @@ for i in {1..${#msgs}} ; do a:${action} \ b:${branch} \ c:${staged} \ + i:${rev} \ + m:${misc} \ r:${base:t} \ s:${vcs} \ u:${unstaged} \ |