You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Kylo Ginsberg <ky...@gmail.com> on 2007/07/24 19:19:58 UTC

Best practice for getting most recent revision number?

Right now I do this in a script like so:
rev=`svn log $SVNROOT -q -r HEAD | grep "^r" | cut -f 1 -d" " | cut -c2-`

Works fine, but a little clunky, not to mention dependent on the format of
log output.  Is there a better way?

Thanks
Kylo

Re: Best practice for getting most recent revision number?

Posted by Blair Zajac <bl...@orcaware.com>.
Kylo Ginsberg wrote:
> Right now I do this in a script like so:
> rev=`svn log $SVNROOT -q -r HEAD | grep "^r" | cut -f 1 -d" " | cut -c2-`
> 
> Works fine, but a little clunky, not to mention dependent on the format 
> of log output.  Is there a better way?
> 
> Thanks
> Kylo

I use svn info

svn info $SVNROOT | awk '$1 == "Revision:" {print $2}'

Regards,
Blair

-- 
Blair Zajac, Ph.D.
http://www.orcaware.com/svn/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practice for getting most recent revision number?

Posted by Larry Martell <la...@gmail.com>.
On 7/24/07, Kylo Ginsberg <ky...@gmail.com> wrote:
> Right now I do this in a script like so:
> rev=`svn log $SVNROOT -q -r HEAD | grep "^r" | cut -f 1 -d" " | cut -c2-`
>
> Works fine, but a little clunky, not to mention dependent on the format of
> log output.  Is there a better way?

'Better' is in the eye of the beholder. Here's how I do it:

svn info | grep 'Revision:' | sed 's/.*: //g'

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Best practice for getting most recent revision number?

Posted by Kylo Ginsberg <ky...@gmail.com>.
Good point.  I was asking client-side, where there's no equivalent AFAIK.

On 7/24/07, Josh Blair <jo...@gmail.com> wrote:
>
> If you are on the server side (as in a hook script), you can use:
>
> svnlook youngest c:\svn\repos
>
> --
> Josh Blair
> Golden, CO
>
> On 7/24/07, Kylo Ginsberg <ky...@gmail.com> wrote:
> >
> > Right now I do this in a script like so:
> > rev=`svn log $SVNROOT -q -r HEAD | grep "^r" | cut -f 1 -d" " | cut
> > -c2-`
> >
> > Works fine, but a little clunky, not to mention dependent on the format
> > of log output.  Is there a better way?
> >
> > Thanks
> > Kylo
> >
>
>
>
>