svn - What does subwcrev need? -


i wrote build script in ant. source code of project versioned in svn.

as part of project had write java class, contains information subversion. in general, build script works fine. needed information gathered, except one. name of author commited last change in reporsitory. though read manual, still come ideas.

my question is: exist way detail ant script?

thanks

edit:

<target name="version" description="set version number">     <echo message="setting version information ..." />     <copy file="build/version.java.template"         tofile="./cq/apps/src/de/anna/util/version.java" />      <tstamp>         <format property="today_de"          pattern="yyyy/mm/dd hh:mm:ss"          locale="de,de"/>     </tstamp>     <replace file="./cq/apps/src/de/anna/util/version.java">         <replacefilter token="@appname@" value="${app.name}" />         <replacefilter token="@buildversion@" value="${build.number}" />         <replacefilter token="@builddate@" value="${today_de}" />     </replace>     <exec executable="${version.tool}" spawn="false" dir=".">         <arg line=". cq/apps/src/de/anna/util/version.java cq/apps/src/de/anna/util/version.java" />     </exec> </target> 

what want add in file version.java, author of last commit , id of change entry. (i think/thought $author$ , $id$ variables)

forget subwcrev , think subversion. that's working with.

in subversion, need set property called svn:keywords, , set value keywords want use. explained in on line subversion manual in keyword substitution.

by using svn:keywords property, have subversion repository handle variable names you. example, have file called information.txt looks this:

the last person check in file $author$ , last version $version$. 

checking file subversion doesn't change $author$ or $revision$.

now, set property svn:keywords on information.txt file:

$ svn propset svn:keywords "author date" information.txt $ svn commit -m"setting svn:keywords set information in information.txt" 

you can through tortoisesvn via context menu tortoisesvn-->properties

now, when @ file, fields changed:

$ cat information.txt last person check in file $author:david$ , last version $revision:123$. 

not want? thing can execute svn info , properties want in xml format. can use <xmlproperties> task read them in properties:

<project>     <property name="target.dir" value="${basedir}/target"/>      <mkdir dir="${target.dir}"/>     <exec executable="svn"         outputproperty="svn.info">         <arg line="info --xml"/>     </exec>     <echo message="${svn.info}"         file="${target.dir}/info.txt"/>     <xmlproperty file="${target.dir}/info.txt"         keeproot="no"         prefix="svn"/>     <echo message="author = &quot;${svn.entry.commit.author}&quot;"/>     <echo message="date = &quot;${svn.entry.commit.date}&quot;"/>     <echo message="revision = &quot;${svn.entry(revision)}&quot;"/> </project> 

i use <exec> task grab subversion information , put in property ${svn.info}. use <echo> task output ${target.dir}/info.txt file. after that, can read file via <xmlproperty> task , pull out information below.

from there, have subversion revision , repository information stored in various properties.

if know resource collections, can without first writing file ${target}/info.txt

<project>     <exec executable="svn"         outputproperty="svn.info">         <arg line="info --xml"/>     </exec>      <xmlproperty keeproot="no"         prefix="svn">         <propertyresource name="svn.info"/>     </xmlproperty>      <echo message="author = &quot;${svn.entry.commit.author}&quot;"/>     <echo message="date = &quot;${svn.entry.commit.date}&quot;"/>     <echo message="revision = &quot;${svn.entry(revision)}&quot;"/> </project> 

hope you're looking for.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -