pydoc patch for Subversion

Eric Mathew Hopper hopper at omnifarious.org
Sun Jan 11 04:06:45 EST 2004


I have a patch that allows pydoc to deal with Subversion
(http://www.subversion.tigris.org) style version strings.

Subversion does not do '$Revsion: num$' style tags.  The closest it will
get is '$Rev: num$'.  So, I included a check for that type as well.

It's a patch to this version of pydoc.py

__version__ = "$Revision: 1.86.8.1 $"

Thanks,
-- 
"It does me no injury for my neighbor to say there are twenty gods or no God.
It neither picks my pocket nor breaks my leg."  --- Thomas Jefferson
"Go to Heaven for the climate, Hell for the company."  -- Mark Twain
-- Eric Hopper (hopper at omnifarious.org  http://www.omnifarious.org/~hopper) --


-------cut---------
--- /sw/lib/python2.3/pydoc.py  Sat Jan  3 15:43:56 2004
+++ pydoc2.3.py Sun Jan 11 00:56:39 2004
@@ -528,8 +528,11 @@
         info = []
         if hasattr(object, '__version__'):
             version = str(object.__version__)
-            if version[:11] == '$' + 'Revision: ' and version[-1:] == '$':
-                version = strip(version[11:-1])
+            if (version[0] == '$') and (version[-1] == '$'):
+                if version[1:11] == 'Revision: ':
+                   version = strip(version[11:-1])
+                elif version[1:6] == 'Rev: ':
+                   version = strip(version[6:-1])
             info.append('version %s' % self.escape(version))
         if hasattr(object, '__date__'):
             info.append(self.escape(str(object.__date__)))
@@ -1004,8 +1007,11 @@
 
         if hasattr(object, '__version__'):
             version = str(object.__version__)
-            if version[:11] == '$' + 'Revision: ' and version[-1:] == '$':
-                version = strip(version[11:-1])
+            if (version[0] == '$') and (version[-1] == '$'):
+                if version[1:11] == 'Revision: ':
+                   version = strip(version[11:-1])
+                elif version[1:6] == 'Rev: ':
+                   version = strip(version[6:-1])
             result = result + self.section('VERSION', version)
         if hasattr(object, '__date__'):
             result = result + self.section('DATE', str(object.__date__))
-------cut---------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040111/422a1848/attachment.sig>


More information about the Python-list mailing list