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

Re: determine latest repo revision?

From: Holger Krekel <pyth_at_devel.trillke.net>
Date: 2004-02-23 14:12:08 CET

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
Received on Mon Feb 23 16:02:50 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.