You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Holger Krekel <py...@devel.trillke.net> on 2004/02/21 13:38:39 UTC

determine latest repo revision?

hi,

given an arbitrary svn url and the 'svn' commandline client, 

a) what is an efficient algorithm/way to determine the latest 
   revision of the whole repository? 

b) how to determine if URL points to a file or a directory?

c) obtain the base url of the underlying repository 

Currently i am trying 'svn ls -v' and traversing up the
url path but it's slow and somehwat fragile.

thanks,

    holger 

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

Re: determine latest repo revision?

Posted by Holger Krekel <py...@devel.trillke.net>.
Ben Collins-Sussman wrote:
> Holger Krekel wrote:
> >hi,
> >
> >given an arbitrary svn url and the 'svn' commandline client, 
> >
> >a) what is an efficient algorithm/way to determine the latest 
> >   revision of the whole repository? 
> 
> 'svn st -u' and look at the last line printed.

This only works for working-copies, not for svn urls ASFAIK. 

> >b) how to determine if URL points to a file or a directory?
> >
> 
> 'svn ls -v'.  Or if you're using the API, call RA->check_path()

hmmm, but if i do:

   $ svn ls -v http://codespeak.net/svn/vpath/branch/refactoring/api.py
      2960      hpk       1806 Feb 14 11:27 api.py
   $ 

how do i know that api.py isn't a directory? It could just conincidentally
contain a file 'api.py', couldn't it? 

> >c) obtain the base url of the underlying repository 
> >
> >Currently i am trying 'svn ls -v' and traversing up the
> >url path but it's slow and somehwat fragile.
> 
> That's all you can do.  The svn client library has no separate concepts 
> of "Repository Root" and "Path within the Repository".  At the moment, 
> there's no way for an svn client to know where that line is drawn in the 
> middle of the URL.  Your technique is probably the best there is.

OK, then i guess i should try some 'bisect' algorithm to get to the root faster :-) 
Coming to think of it, it would actually  make sense especially for long
urls (which are not that rare, anyway). 

The reason we are needing the latest repo revision is, btw, that we
want to offer a consistent programmatic view across the repository, 
no matter at which url you start.  Maybe we should just use the 
maximum revision of the current path (or the maximum of its child revs)
but this might yield unwanted results if you are traveling up. 

cheers & thanks,

    holger

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

Re: determine latest repo revision?

Posted by Mark Benedetto King <mb...@lowlatency.com>.
On Sun, Feb 22, 2004 at 11:40:51PM -0600, Ben Collins-Sussman wrote:
> 
> >c) obtain the base url of the underlying repository 
> >
> >Currently i am trying 'svn ls -v' and traversing up the
> >url path but it's slow and somehwat fragile.
> 
> That's all you can do.  The svn client library has no separate concepts 
> of "Repository Root" and "Path within the Repository".  At the moment, 
> there's no way for an svn client to know where that line is drawn in the 
> middle of the URL.  Your technique is probably the best there is.
> 

If you're willing to go to the RA layer instead, there's get_repos_root().

--ben


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

Re: determine latest repo revision?

Posted by Ben Collins-Sussman <su...@collab.net>.
Holger Krekel wrote:
> hi,
> 
> given an arbitrary svn url and the 'svn' commandline client, 
> 
> a) what is an efficient algorithm/way to determine the latest 
>    revision of the whole repository? 

'svn st -u' and look at the last line printed.

> 
> b) how to determine if URL points to a file or a directory?
> 

'svn ls -v'.  Or if you're using the API, call RA->check_path()

> c) obtain the base url of the underlying repository 
> 
> Currently i am trying 'svn ls -v' and traversing up the
> url path but it's slow and somehwat fragile.

That's all you can do.  The svn client library has no separate concepts 
of "Repository Root" and "Path within the Repository".  At the moment, 
there's no way for an svn client to know where that line is drawn in the 
middle of the URL.  Your technique is probably the best there is.

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