pydoc patch for Subversion

E

Eric Mathew Hopper

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 ([email protected] 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---------

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAARIkjtsvlOwvazYRAqUvAJ9j/bnIozFiPbmBWkOLR59zyaPZUQCgukkc
yHAO+4UDP1l00FBBNMejvkk=
=3NUT
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top