[Python-Dev] Expose Subversion revision number to Python
Phillip J. Eby
pje at telecommunity.com
Fri Dec 16 07:38:53 CET 2005
At 12:16 AM 12/16/2005 -0500, Barry Warsaw wrote:
>SF patch # 1382163 is a fairly simple patch to expose the Subversion
>revision number to Python, both in the Py_GetBuildInfo() text, and in a
>new Py_GetBuildNumber() C API function, and via a new sys.build_number
>attribute. This number is calculated from the output of "svn info" at
>the top of the tree.
FYI, this is not the true revision number; it's only the revision number in
which the directory was last modified, not the latest revision number
within the tree.
You probably want to do a bit more processing of "svn info -R", or else
parse the .svn/entries files yourself. There's some Python code that does
this at:
http://svn.python.org/projects/sandbox/trunk/setuptools/setuptools/command/egg_info.py
Specifically, see the 'get_svn_revision' method for an example of
processing .svn/entries files to find out the highest committed revision
number in a source tree.
More information about the Python-Dev
mailing list