[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Getting HEAD revision number from a URL

From: J Robert Ray <jrray_at_imageworks.com>
Date: 2004-10-28 04:23:26 CEST

Juanma Barranquero wrote:
> On Tue, 26 Oct 2004 16:52:44 -0700, "Krebs, Steven" <steven.krebs@intel.com> wrote:
>
>
>>FYI: here is my final solution (for svn client on WinXP with PERL):
>>
>>svn log -q -v -rHEAD <URI> | perl -nle "if(m/^r(\d+)/){~s/^r(\d+).*/set HeadRev=$1/;print;}"
>
>
> Wouldn't it be shorter (à la Perl Golf) one of these?
>
> svn log -q -v -rHEAD <URI> | perl -ne "print'set HeadRev=',$1 if/^r(\d+)/"
> svn log -q -v -rHEAD <URI> | perl -ne "s/^r(\d+).*/set HeadRev=$1/&&print"
> svn log -q -v -rHEAD <URI> | perl -ne "s/^r(\d+)/print'set HeadRev=',$1/e"
> svn log -q -v -rHEAD <URI> | perl -ne "/^r(\d+)/&&print'set HeadRev=',$1"
>
> (Sorry, couldn't resist ;)

None of these work for me because my shell swallows "$1", but this works
and it even shorter:

svn log -q -v -rHEAD <URI> | perl -ne '/^r(\d+)/&&print"set HeadRev=$1"'

- Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Oct 28 04:24:09 2004

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.