about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-09-23 16:48:27 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-09-23 16:48:27 +0000
commitc328252c58d215cc116dacd36a7e53ba3fc3c1f0 (patch)
tree48e2d03eac2bd0a86c1490948951fc5b2b4ea5bb
parentf49d738db3d6cacb17cf4374f61948c5634c3aab (diff)
downloadzsh-c328252c58d215cc116dacd36a7e53ba3fc3c1f0.tar.gz
zsh-c328252c58d215cc116dacd36a7e53ba3fc3c1f0.tar.xz
zsh-c328252c58d215cc116dacd36a7e53ba3fc3c1f0.zip
25733: add revision number to Perforce vcs_info backend
add abbreviation to list of backends
-rw-r--r--ChangeLog4
-rw-r--r--Doc/Zsh/contrib.yo21
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_p414
3 files changed, 27 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 202a2fd7b..4c0ba1771 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-09-23  Peter Stephenson  <pws@csr.com>
 
+	* 25733: Functions/VCS_Info/Backends/VCS_INFO_get_data_p4,
+	Doc/Zsh/contrib.yo: add revision number (latest synced change)
+	to Perforce backend and list abbreviations with backends.
+
 	* 25732: Functions/VCS_Info/Backends/VCS_INFO_detect_p4,
 	Doc/Zsh/contrib.yo: make vcs_info detect Perforce from server
 	if style use-server is set.
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 44b918aac..ed17e3034 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -328,19 +328,20 @@ instantly tell on which branch you are currently on,  for example.
 
 In order to do that, you may use the tt(vcs_info) function.
 
-The following VCSs are supported:
+The following VCSs are supported, showing the abbreviated name by which
+they are referred to within the system:
 startsitem()
-sitem(tt(bazaar))(http://bazaar-vcs.org/)
-sitem(tt(codeville))(http://codeville.org/)
-sitem(tt(cvs))(http://www.nongnu.org/cvs/)
+sitem(Bazaar (tt(bzr)))(http://bazaar-vcs.org/)
+sitem(Codeville (tt(cdv)))(http://codeville.org/)
+sitem(Concurrent Versioning System (tt(cvs)))(http://www.nongnu.org/cvs/)
 sitem(tt(darcs))(http://darcs.net/)
 sitem(tt(git))(http://git.or.cz/)
-sitem(tt(gnu arch))(http://www.gnu.org/software/gnu-arch/)
-sitem(tt(mercurial))(http://selenic.com/mercurial/)
-sitem(tt(monotone))(http://monotone.ca/)
-sitem(tt(perforce))(http://www.perforce.com/)
-sitem(tt(subversion))(http://subversion.tigris.org/)
-sitem(tt(svk))(http://svk.bestpractical.com/)
+sitem(GNU arch (tt(tla)))(http://www.gnu.org/software/gnu-arch/)
+sitem(Mercurial (tt(hg)))(http://selenic.com/mercurial/)
+sitem(Monotone (tt(mtn)))(http://monotone.ca/)
+sitem(Perforce (tt(p4)))(http://www.perforce.com/)
+sitem(Subversion (tt(svn)))(http://subversion.tigris.org/)
+sitem(SVK (tt(svk)))(http://svk.bestpractical.com/)
 endsitem()
 
 To load var(vcs_info):
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4 b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
index 82ca6ef1c..749d2ef4c 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
@@ -10,5 +10,15 @@ local -A p4info
 p4 info | while IFS=: read a b; do p4info[${a// /_}]="${b## #}"; done
 p4base=${vcs_comm[basedir]}
 
-# We'll use the client name as the branch; close enough
-VCS_INFO_formats '' "${p4info[Client_name]}" "${p4base}"
+# We'll use the client name as the branch; close enough.
+local p4branch change
+# We'll use the latest change number to which the hierarchy from
+# here down is synced as the revision.
+# I suppose the following might be slow on a tortuous client view.
+change="${${$(p4 changes -m 1 ...)##Change }%% *}"
+zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat p4branch ||
+p4branch="%b:%r"
+zformat -f p4branch "${p4branch}" "b:${p4info[Client_name]}" \
+"r:$change"
+
+VCS_INFO_formats '' "${p4branch}" "${p4base}"