On a couple of projects now, I've used the SVN keywords to retrieve some information about the version of some core files. Something like this (PHP):
$revision = '$Revision: 1254 $'; // automatically updated each commit
$revision = preg_replace("/[^0-9]/", "");
echo "This file is at revision #" . $revision;
It occurred to me however, by inspecting the $URL$
keyword output, I could tell if the current file was in a tag, branch or on the trunk and apply different logic to the program, eg, increase the cache times, etc.
$svnURL = '$URL: path/to/repo/tags/1.0.1/folder/file.txt $';
if (strpos($svnURL, "/tags/") !== false) {
echo "Tagged version!";
}
Is this veering sharply into WTF territory, or would you consider this practice to be acceptable?