Is there a Subversion command to show the current revision number?
After svn checkout
I want to start a script and need the revision number in a variable.
Use something like the following, taking advantage of the XML output of subversion:
# parse rev from popen "svn info --xml"
dom = xml.dom.minidom.parse(os.popen('svn info --xml'))
entry = dom.getElementsByTagName('entry')[0]
revision = entry.getAttribute('revision')
Note also that, depending on what you need this for, the
entry may be more what you're looking for. That gives the "Last Changed Rev", which won't change until the code in the current tree actually changes, as opposed to "Revision" (what the above gives) which will change any time anything in the repository changes (even branches) and you do an "svn up", which is not the same thing, nor often as useful.