[Python-Dev] Expose Subversion revision number to Python

Phillip J. Eby pje at telecommunity.com
Fri Dec 16 17:33:00 CET 2005


At 05:17 PM 12/16/2005 +0100, Armin Rigo wrote:
>Hi Phillip,
>
>On Fri, Dec 16, 2005 at 10:59:23AM -0500, Phillip J. Eby wrote:
> > The "Revision" from "svn info" isn't reliable; it doesn't actually relate
> > to what version of code is in the subtree.  It can change when nothing has
> > changed.
>
>Indeed, the patch should not use the "Revision" line but the "Last
>Changed Rev" one.
>
> > SVN does track the actual
> > *changed* revision, it just takes a little more work to get it.
>
>Not if you're happy with "Last Changed Rev":
>
>     LC_ALL=C svn info | grep -i "last changed rev" | cut -f 4 -d " "

You left off the all-important "-R" from "svn info", and the "sort -nr | 
head -1" at the end.  The "Last Changed Rev" of the root is not necessarily 
the highest "Last Changed Rev", no matter how or where you update or check 
out.  Try it and see.



More information about the Python-Dev mailing list