This is how I extract a CVS branch sticky tag. If you use the HEAD branch, there's no 
Tag file, the <loadfile> issues a warning (but doesn't fail), and the tag is defaulted 
to HEAD by <property>. The <replaceregex> are there to convert TTTAG_NAME into 
TAG_NAME. The ^D.* variant is when you update/checkout by date instead of tag, in 
which case I assume HEAD. Someone also submitted a custom task to do this, which must 
be in BugZilla somewhere. It didn't go into Ant, partly because the Ant snippet below 
is 90% of the solution, albeit longer, and can be made into a <macrodef> easily. --DD
 
        <loadfile property="tag" failonerror="false"
                  srcfile=".../CVS/Tag <mailto:${modules}/@{name}/CVS/Tag> ">
          <filterchain>
            <striplinebreaks/>
            <tokenfilter>
              <replaceregex pattern="^T" replace="" />
              <replaceregex pattern="^D.*" replace="HEAD" />
            </tokenfilter>
          </filterchain>
        </loadfile>
        <property name="tag" value="HEAD" />

________________________________

From: Alison Monteith [mailto:[EMAIL PROTECTED]
Sent: Tue 11/2/2004 5:39 PM
To: Ant Users List
Subject: getting tag from CVS for use in Ant



Hi,

I don't know much about ant and am trying to fix a problem in our
existing build.xml file.

We have many branches in CVS and our normal procedue is to checkout out
a module which contains a build.xml file then run an ant package in this
directory which creates our software packages etc.  As part of the build
script a file called release.txt is created which should contain the cvs
tag and date and timestamp. 

Here are the relevant lines from build.xml:

<property name="label" value=${build_num} ${DSTAMP} ${TSTAMP}" />

<exec dir="www"
          executable="echo"
          output="www/release.txt"
          <arg line="${label}"/>
</exec>

Nowhere in build.xml is build_num set, so as expected the output is
"${build_num} <actual date> <actual time>"

Does anyone know how to set a variable (in this case ${build_num}) with
the cvs tag for the current module?

Thanks in advance for any info.

Alison







---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to