You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Garrick Olson <Ga...@Aceva.com> on 2004/02/01 10:04:16 UTC

What is the easiest way to determine the HEAD revision number?

Some code I am writing needs to determine the latest revision number in
the repository.

I am currently doing this by issuing a command like:

svn log --non-interactive --xml -r HEAD:COMMITTED mywc

This may return (many) multiple log entries, but the first entry should
contain the latest revision.

Will this command work in *all* situations? (No situations where is
might return no entries?)
Is there a more direct or efficient way to do this?

Re: What is the easiest way to determine the HEAD revision number?

Posted by John Peacock <jp...@rowman.com>.
Garrick Olson wrote:
> 
> 
> Some code I am writing needs to determine the latest revision number in 
> the repository.
> 

Is this not what you want?

> $ svnversion
> usage: svnversion [options] wc_path [trail_url]
> 
>   Produce a compact "version number" for the working copy path
>   WC_PATH.  TRAIL_URL is the trailing portion of the URL used to
>   determine if WC_PATH itself is switched (detection of switches
>   within WC_PATH does not rely on TRAIL_URL).  The version number
>   is written to standard output.

NOTE: this is the highest revision for this WC path, which is, I think, what you 
are getting from your 'svn log...' call as well.  Neither will give the highest 
(i.e. most recent) commit to the _entire_ repository.  For that, you should use:

> $ svnlook help youngest
> youngest: usage: svnlook youngest REPOS_PATH
> 
> Print the youngest revision number.

HTH

John

-- 
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747


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