views:

171

answers:

2

For an improved bugreporting I'd like if the tag android:versionName automatically contains the number of the revision on the svn server. Anyone knows how to do that? Thanks

`

+1  A: 

Try svn:keywords.

CommonsWare
I read it, but the text says that the following keywords are supported: "HeadURL (abbreviated as URL), which expands to the URL of the file in the repository; LastChangedBy (abbreviated as Author), which expands to the username of the last person who modified the file; LastChangedDate (abbreviated as Date), which stores the date on which the file was last modified; LastChangedRevision (abbreviated as Rev), which stores the revision in which the file last changed; and Id, which stores a compressed version of the other four keywords." So if I understand it correctly I have to use this identifier
Roflcoptr
in the manifest file to replace the android:versionName but then it only works if the manifest is also changed if I commit a new revision?
Roflcoptr
I have not used SVN in quite some time. Back when I did use it, `svn:keywords` expanded on checkout. So, your process to go to production needs to do a build from a fresh checkout, and then the manifest file will contain the `Rev` keyword wherever you place it.
CommonsWare
the problem is, i can't save something like this in the manifest:android:versionName=$Rev$
Roflcoptr
svn:keywords "LastChangedRevision" is _not_ what you want; that gives you the last revision in which this particular file was modified.
Stobor
+1  A: 

You could use a start-commit hook that writes the current time stamp into the android:versionName in the manifest. You'd have to write a small script that uses some regex to insert the current time stamp into the AndroidManifest.xml, and then call that as pre-commit hook

The revision number that's being checked in is not yet known for the start-commit hook, so you cannot write it to the manifest.

I haven't really used those hooks myself. As far as I understand, you can make a directory /repoName/.svn/hook/, and inside that, you create one or more executables, e.g. "start-commit", that does what you want.

This seems like a nice starting point if you want to know more about the hooks: A Subversion Pre-Commit Hook

pableu