Re: [viewvc-users] Show Revision in Root View

"C. Michael Pilato" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.viewcvs.user
Organization CollabNet, Inc.
Message-ID <4B97C592.1080703__44124.6205744848$1268237728$gmane$org@collab.net>
Chris Cralle wrote:
> Maybe I phrased the question wrong or I don't quite understand your
> reply.
> 
> Is there any way to get the revision number which is provided by the
> directory view to be available in the root view?

Not without tweaking ViewVC's Python code.  For example, you could change
the lib/viewvc.py:view_roots() function to query the youngest revision
number of each of the Subversion roots ViewVC is configured to display.  I
don't think there is a simple single function call you could add there,
though -- you'd need to do some real work.

Aaaah, I'm too soft.  So just for kicks, I took a crack at hacking something
together really quick-like.  See attached patch (made against the current
trunk code).

Disclaimer:  I make no promises and accept no responsibility for your use of
this patch, and have no intentions of including such in a future ViewVC
release.  (Though I will take under advisement the general desire for the
feature.)

-- 
C. Michael Pilato <[email protected]>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2457698

To unsubscribe from this discussion, e-mail: [[email protected]].
viewvc-roots-youngest-rev-patch.txt (text/plain, 2.1 KB)
Index: templates/roots.ezt
===================================================================
--- templates/roots.ezt	(revision 2324)
+++ templates/roots.ezt	(working copy)
@@ -9,6 +9,7 @@
 <thead>
 <tr>
   <th class="vc_header_sort">Name</th>
+  <th class="vc_header_sort">Youngest Revision</th>
 </tr>
 </thead>
 
@@ -20,6 +21,7 @@
       <img src="[docroot]/images/dir.png" alt="" class="vc_icon" />
       [roots.name]</a>
     </td>
+    <td>[roots.youngest_rev]</td>
   </tr>
 [end]
 </tbody>
Index: lib/viewvc.py
===================================================================
--- lib/viewvc.py	(revision 2326)
+++ lib/viewvc.py	(working copy)
@@ -1850,9 +1850,13 @@
       href = request.get_url(view_func=view_directory,
                              where='', pathtype=vclib.DIR,
                              params={'root': rootname}, escape=1)
+      youngest_rev = None
+      if allroots[rootname][1] == 'svn':
+        youngest_rev = allroots[rootname][2]
       roots.append(_item(name=request.server.escape(rootname),
                          type=allroots[rootname][1],
                          path=allroots[rootname][0],
+                         youngest_rev=youngest_rev,
                          href=href))
 
   data = common_template_data(request)
@@ -4251,11 +4255,16 @@
   for root in cfg.general.svn_roots.keys():
     auth = setup_authorizer(cfg, request.username, root)
     try:
-      vclib.svn.SubversionRepository(root, cfg.general.svn_roots[root], auth,
-                                     cfg.utilities, cfg.options.svn_config_dir)
+      repos = vclib.svn.SubversionRepository(root, cfg.general.svn_roots[root], auth,
+                                             cfg.utilities, cfg.options.svn_config_dir)
+      try:
+        repos.open()
+        youngest_rev = repos.youngest
+      except:
+        youngest_rev = None
     except vclib.ReposNotFound:
       continue
-    allroots[root] = [cfg.general.svn_roots[root], 'svn']
+    allroots[root] = [cfg.general.svn_roots[root], 'svn', youngest_rev]
 
   # Add the viewable CVS roots
   for root in cfg.general.cvs_roots.keys():
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkuXxZIACgkQokEGqRcG/W7/agCeMEnjv/PcNgYI+rPFAnFK+7g6
pscAoLnCneEMLD+hPqM999GYwmBElurW
=KqJg
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.