Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: (1/5) vcs_info: add revision and "misc" argument to VCS_INFO_formats()
- X-seq: zsh-workers 26816
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: (1/5) vcs_info: add revision and "misc" argument to VCS_INFO_formats()
- Date: Mon, 6 Apr 2009 19:45:34 +0200
- In-reply-to: <1239039938-20782-1-git-send-email-ft@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <1239039938-20782-1-git-send-email-ft@xxxxxxxxxxxxxxxxxxx>
There is no reason why the revision should only be available in
branchformat. This way it's in formats and actionformats, too.
As %i (think: identifier) as %r and %R where both taken already.
This also adds a "misc" parameter that currently nobody uses. But I'm
planning to make the hg backend use it.
---
Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_cdv | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_cvs | 2 +-
.../VCS_Info/Backends/VCS_INFO_get_data_darcs | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_mtn | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_svk | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 2 +-
Functions/VCS_Info/Backends/VCS_INFO_get_data_tla | 2 +-
Functions/VCS_Info/VCS_INFO_formats | 21 +++++++++++++++++++-
12 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr
index 1030c06..e85de31 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 2c516ea..4f81184 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 1c222ce..ed738b9 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 a1ebbb6..3f6a226 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 75d39cc..745be34 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -108,5 +108,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}" '' ''
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 fb7c450..d70e03c 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 63f0601..0a8064c 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 ac87faf..e4bbb06 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 48e5edb..29cda81 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 e180805..75da22b 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 69a82eb..f015e0c 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@xxxxxxxxxxx/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 72030cc..35b3b96 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} \
--
1.6.2.1.136.g8e24
Messages sorted by:
Reverse Date,
Date,
Thread,
Author