Ops/VersionKeys

From Ops/Core

The python- and actorcore- based actors each generate a version keyword based on SVN information. The intent is to provide a concise version string when possible, but to expose most of the visible active revision information during development. Here's the deal, as expressed in actorcore v1_12. The logic was slightly different before that; I'll describe the differences later.

The main actor class is a subclass of actorcore's Actor. The subclass should contain a .headURL instance variable with the standard magic "$HeadURL$" string. That file should have the keywords svn property set to indicate the HeadURL expansion, using something like svn propset svn:keywords HeadURL boss_main.py. If it does, the magic string gets expanded to, for example:

self.headURL = "$HeadURL: svn+ssh://sdss3svn@sdss3.org/repo/ops/boss/trunk/python/boss/boss_main.py $"

or

self.headURL = "$HeadURL: svn+ssh://sdss3svn@sdss3.org/repo/ops/boss/tags/v2_3_0/python/boss/boss_main.py $"

If it exists, that variable is used to deduce whether the version is for a tag, a branch, or the trunk. And if a tag or branch, the associated name. If the variable does not exist, we try to use the HeadURL property from svn info.

For tags, we try to be succinct:

version="v2_3_0" 

For branches or trunk, we show that, using a stupidly ambiguous notation:

version="branch_v1_0_20b"
version="trunk" 

Obviously, "trunk" is uninformative. And frankly, it is possible to edit tagged versions. So we also try to get and use revision information from svnversion. If the version is not for a tag or if the obnoxious svnversion output indicates modifications, we tack on some revision information. So:

version="trunk+svn111671" 

or

version="branch_v1_0_20b+svn111677" 

We try to display the _newest_ revision if svnversion indicates a range of active revisions. But we always include any M (or C or S, should they appear) if there are any unchecked in changes or other oddities. Basically, if there is a revision but no M, the version is just as good as a tag: you can get the exact running version. If there is a trailing M all bets are off. I do not know of any reasonable way to encode the uncommitted changes.

If the HeadURL is unparseable, the entire URL is dumped"

version=unknown:svn+ssh://sdss3svn@sdss3.org/repo/ops/actors/guiderActor/trunk+svn107183M'

OK, what changed with v1_12? Before that, actorcore used svn info output in preference to any .HeadURL variable. And there were a couple of regexp bugs which caused some URLs to be unparsed. That last example was just fine, actually. The version should have been trunk+svn107183M.

Finally, svnversion only works on live {svn co directories. Without that, no revision information is available.