Something like this should work:
<exec executable="svn">
<arg line="update > file.txt"/>
</exec>
<loadfile property="file.txt.contents" srcFile="file.txt"/>
<propertyregex property="Revision.Number"
input="${file.txt.contents}"
regexp="Updated to revision (.*)"
replace="\1"/>
This loads the contents of the file into the file.txt.contents property,
then parses the revision number out and sets it in the Revision.Numberproperty.
<loadfile> is an Ant core task, and <propertyregex> is part of ant-contrib.
I haven't tested this, so you may have to play around more with the regular
expression.
-Andrew
On 9/7/05, S I <[EMAIL PROTECTED]> wrote:
>
> I'm now looking at <concat> not sure how to go about it and I do realize
> Ant
> is not a script lanugage however, I'm not sure how to go about my problem
> either except resorting to a scripting language. I will briefly state my
> problem and please tell me if parsing could be achieved via any Ant task?
>
> I have a text file which is generated by running
>
> c:\>svn update > file.txt.
>
> file.txt's last line is "Updated to revision 20779."
>
> I would like to extrapolate only the numbers and pass it back to :
> ${Revision.Number} = 20779
>
> c:\>svn copy -r ${Revision.Number} /trunk /tag/${Revision.Number}
>
> Is there anyway to do this in Ant? Looks like I have to write a perl
> script
> and pass the value back to the Ant script by running <exec>
>
>
> ----Original Message Follows----
> From: James Abley <[EMAIL PROTECTED]>
> Reply-To: "Ant Users List" <[email protected]>
> To: Ant Users List <[email protected]>
> Subject: Re: No Apache Ant Support for Subversion? Oh man :(
> Date: Wed, 07 Sep 2005 07:36:57 +0100
> MIME-Version: 1.0
> Received: from mail.apache.org <http://mail.apache.org>
> ([209.237.227.199<http://209.237.227.199>])
> by mc10-f40.hotmail.com <http://mc10-f40.hotmail.com>
> with Microsoft SMTPSVC(6.0.3790.211); Tue, 6 Sep 2005 23:37:11 -0700
> Received: (qmail 50368 invoked by uid 500); 7 Sep 2005 06:37:03 -0000
> Received: (qmail 50350 invoked by uid 99); 7 Sep 2005 06:37:03 -0000
> Received: from asf.osuosl.org <http://asf.osuosl.org> (HELO
> asf.osuosl.org<http://asf.osuosl.org>)
> (140.211.166.49 <http://140.211.166.49>) by
> apache.org <http://apache.org> (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2005
> 23:37:03 -0700
> Received: pass (asf.osuosl.org <http://asf.osuosl.org>: local policy)
> Received: from [213.86.197.2 <http://213.86.197.2>] (HELO
> mail.volantis.com <http://mail.volantis.com>)
> (213.86.197.2<http://213.86.197.2>)
> by
> apache.org <http://apache.org> (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2005
> 23:37:14 -0700
> Received: squid 10.20.30.27 <http://10.20.30.27> from
> 10.20.30.21<http://10.20.30.21>
> 10.20.30.21 <http://10.20.30.21> via HTTP with
> MS-WebStorage 6.0.6249
> Received: from c-jabley by squid; 07 Sep 2005 07:36:57 +0100
> X-Message-Info: JGTYoYF78jEHjJx36Oi8+Z3TmmkSEdPtfpLB7P/ybN8=
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Precedence: bulk
> List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
> List-Help: <mailto:[EMAIL PROTECTED]>
> List-Post: <mailto:[email protected]>
> List-Id: "Ant Users List" <user.ant.apache.org<http://user.ant.apache.org>
> >
> Delivered-To: mailing list [email protected]
> X-ASF-Spam-Status: No, hits=0.0 required=10.0tests=
> X-Spam-Check-By: apache.org <http://apache.org>
> References: <[EMAIL PROTECTED]>
> X-Mailer: Ximian Evolution 1.4.6
> X-Virus-Checked: Checked by ClamAV on apache.org <http://apache.org>
> Return-Path: [EMAIL PROTECTED]
> X-OriginalArrivalTime: 07 Sep 2005 06:37:11.0164 (UTC)
> FILETIME=[93794BC0:01C5B376]
>
> On Wed, 2005-09-07 at 04:37, S I wrote:
> > Hi
> >
> > I wish there was Ant Core Task support for Subversion. I have downloaded
> > bunch of 3rd party utilities, althought they accomplish the job somewhat
> > clumsily, they'll do for now. Is there going to be support for
> Subversion
> > soon?
> >
> > My 2nd question: I'm modifying my Ant scripts to commit couple of files
> > into SVN and then tag the repository. I don't like the limited options
> of
> > SVN in how it handles tagging. I run my build files from my WinXP and
> > repository's on a Linux server under Apache. Does Ant have any feature
> to
> > allow me to parse a log file and grep for a revision number, then pass
> that
> > rev# to the "svn copy /trunk /tag/rev#" without resorting to Perl or any
> > other scripting language?
> >
>
> Have a look at <concat /> with filterchains, and then load the output
> into your revision property via <loadfile />
>
> James
>
> > Thanks
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>