As Daniel suggested, setting the buildnumber during the build might be a
better idea. We specifically do this make sure only 'official' builds
have proper build numbers.
Regardless, you could use svnAnt in an ant script get the subversion
revision, and optionally to commit the result of the replacement. This
is what we use in an ant script (for a .net application):
<svn refid="svnBspaas">
<wcversion path="${svnDir}"/>
</svn>
<echo message="Updating version to
${env.SPAAS_VERSION}.${env.BUILD_NUMBER}.${revision.max}"/>
<fileset id="PropInfo" dir="${env.WORKSPACE}"
includes="**/Properties/AssemblyInfo.cs" />
<replaceregexp match='(AssemblyVersion[^"]*").*"\)]'
replace='\1${env.SPAAS_VERSION}.${env.BUILD_NUMBER}.${revision.max}")]'
byline="true">
<fileset refid="PropInfo"/>
</replaceregexp>
AVee