zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: vcs_info: Perforce revision numbers and backend names
Date: Tue, 23 Sep 2008 17:45:45 +0100	[thread overview]
Message-ID: <16807.1222188345@csr.com> (raw)

This fixes up revision numbers in Perforce---it's taken to be the
most recent change to which the hierarchy from the current directory
down is synced, which is about the best I can do in a single
number---and also adds the abbreviation for each backend to the initial
list.

Index: Doc/Zsh/contrib.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/contrib.yo,v
retrieving revision 1.89
diff -u -r1.89 contrib.yo
--- Doc/Zsh/contrib.yo	23 Sep 2008 16:11:01 -0000	1.89
+++ Doc/Zsh/contrib.yo	23 Sep 2008 16:43:15 -0000
@@ -328,19 +328,20 @@
 
 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):
Index: Functions/VCS_Info/Backends/VCS_INFO_get_data_p4
===================================================================
RCS file: /cvsroot/zsh/zsh/Functions/VCS_Info/Backends/VCS_INFO_get_data_p4,v
retrieving revision 1.1
diff -u -r1.1 VCS_INFO_get_data_p4
--- Functions/VCS_Info/Backends/VCS_INFO_get_data_p4	19 Sep 2008 12:58:54 -0000	1.1
+++ Functions/VCS_Info/Backends/VCS_INFO_get_data_p4	23 Sep 2008 16:43:15 -0000
@@ -10,5 +10,15 @@
 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}"


-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


                 reply	other threads:[~2008-09-23 16:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16807.1222188345@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).