You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Christopher H. Laco" <cl...@chrislaco.com> on 2005/10/29 21:01:54 UTC

Perl equiv for 'svn info http://example.com/repos'?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I have some code that uses SVN::Client to connect to a subversion server
using http. I can do all of the usual things.. list files and folders
with their last authoer, revisions, size, etc, and read the contents of
files.

What I can't seen to figure out is how to get the current revisions of
that repository?

I thought that SVN::Repos would connect to it, and then is the
fs->revision_root...but it appears the SVNB::Repos::open doesn't like
http paths at all.

I'm trying to get the same information from the SVN perl modules that is
found by doing this:

> claco@NP5660:~/HandelFramework$ svn info http://handelframework.com/svn
> Path: svn
> URL: http://handelframework.com/svn
> Repository Root: http://handelframework.com/svn
> Repository UUID: 52a70e3a-55ec-0310-b14e-7917f69ecacc
> Revision: 901
> Node Kind: directory
> Last Changed Author: claco
> Last Changed Rev: 901
> Last Changed Date: 2005-10-24 20:31:03 -0400 (Mon, 24 Oct 2005)


Thanks.
- -=Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDY+NC+66dLHM50ssRAnmVAKCOng76S7ICMrFWDmCI3l5+Tg3iCwCgjSnB
o1dm3oHjhFazGk60pUwTagk=
=KqKo
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:

> > Well, unfortunately, I don't think you can actually get that data
> > without doing a bunch of calls to the repos.
>
> I was getting that impression. It's not a major requirement, but it
> would be nice.
>
> >
> > Note that most repository viewer software uses the libsvn_repos and
> > libsvn_fs APIs, not the libsvn_client and libsvn_ra APIs.  It's much
>
> OK, I'll bite. What's the difference between the first two, and the last
> two in the big picture? Don't the first two imply that the repos viewer
> is on the same machine as the repo itself?
>
> Does SVN::Repos fall into that?

libsvn_client is the C level library that corresponds to the perl
module SVN::Client.  libsvn_ra is the C level library that corresponds
to SVN::Ra.  Both of these generally communicate with the repository
over the network.

libsvn_repos and libsvn_fs are the C level libraries for talking
directly to a repository (in Perl that's SVN::Repos and SVN::Fs), they
give you a different kind of API, one that lets you do a lot of the
kind of things you're trying to do, but yes, you do have to be on the
same machine as the repository itself.

-garrett

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


Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Garrett Rooney wrote:
> On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> 
> 
>>>Well, ->ls should give you the last changed revision, so that should
>>>be enough to use ->log to get you the log.  I suspect it might be a
>>
>>Where's that log method? on each dirent returned?
>>svn_dirent_t appears to only have:
>>
>>kind, size, has_props, created_Rev, time, last_author... no log.
>>
>>package _p_svn_dirent_t inherits Core, but it's not clear to me what
>>Core has really...
> 
> 
> SVN::Client should have a log method of some sort.


Yeah it does. But that seems to imple that while looping through a list
of items, I need to call log(itempath, itemrev, itemrev) on each one to
get it's last log.

If I have 100 items, that 100 more calls to the repo. That's can't be fast.

I could also call log([all,items,paths]), but what do I put in start/end
revision params since each item has a differen rev number?

> Well, unfortunately, I don't think you can actually get that data
> without doing a bunch of calls to the repos.

I was getting that impression. It's not a major requirement, but it
would be nice.

> 
> Note that most repository viewer software uses the libsvn_repos and
> libsvn_fs APIs, not the libsvn_client and libsvn_ra APIs.  It's much

OK, I'll bite. What's the difference between the first two, and the last
two in the big picture? Don't the first two imply that the repos viewer
is on the same machine as the repo itself?

Does SVN::Repos fall into that?

- -=Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDZWoE+66dLHM50ssRAhWWAJkBbLr5BlPalmJx4Nk/Qdi0Tre0bgCfV82q
sx4nafX76C502T+kETtNkkM=
=h1g5
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:

> > Well, ->ls should give you the last changed revision, so that should
> > be enough to use ->log to get you the log.  I suspect it might be a
>
> Where's that log method? on each dirent returned?
> svn_dirent_t appears to only have:
>
> kind, size, has_props, created_Rev, time, last_author... no log.
>
> package _p_svn_dirent_t inherits Core, but it's not clear to me what
> Core has really...

SVN::Client should have a log method of some sort.

> > bit easier to solve your problem if you explain exactly what you're
> > trying to do though.
>
> I'm trying to write a Model plugin for Catalyst to do basic browsing,
> something along the lines of the Trac source browser. I could be
> browsing a repo at http, svn://, or file://, but it's nothing to do with
> working copies.
>
> I can use Ra to get the uuid, root_rev..although, that would be nice in
> SVN::Client too.

People keep asking for this, but I have to admit I don't see why.  All
any SVN::Client method that retrieves that data is going to be is just
a stupidly thin wrapper around the SVN::Ra method that retrieves it.

> I'm currently using the SVN::Client to fetch the list of items in each
> path. I'd like to get the last_log for each of the items too.
>
> It's not too clear to me yet how to get all that info without making too
> many calls to the repo.

Well, unfortunately, I don't think you can actually get that data
without doing a bunch of calls to the repos.

Note that most repository viewer software uses the libsvn_repos and
libsvn_fs APIs, not the libsvn_client and libsvn_ra APIs.  It's much
easier to do this sort of thing there, the APIs really are more suited
to it.  It's kind of hard to do the stuff you're trying to do without
making a lot of calls because the client apps don't generally try to
do that sort of thing.

-garrett

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


Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Garrett Rooney wrote:
> On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> 
> 
>>SVN::Client works fine, but it's also a little unclear on how to get
>>svn:log props for each dirent returned from ->ls without making seperate
>>calls to get_prop for each item when looping through them.
> 
> 
> Well, ->ls should give you the last changed revision, so that should
> be enough to use ->log to get you the log.  I suspect it might be a

Where's that log method? on each dirent returned?
svn_dirent_t appears to only have:

kind, size, has_props, created_Rev, time, last_author... no log.

package _p_svn_dirent_t inherits Core, but it's not clear to me what
Core has really...


> bit easier to solve your problem if you explain exactly what you're
> trying to do though.

I'm trying to write a Model plugin for Catalyst to do basic browsing,
something along the lines of the Trac source browser. I could be
browsing a repo at http, svn://, or file://, but it's nothing to do with
working copies.

I can use Ra to get the uuid, root_rev..although, that would be nice in
SVN::Client too.

I'm currently using the SVN::Client to fetch the list of items in each
path. I'd like to get the last_log for each of the items too.

It's not too clear to me yet how to get all that info without making too
many calls to the repo.

> 
> 
>>At this point, I've be a little more productive just parsing the cmd
>>line client output. :-/
> 
> 
> Well, there's nothing wrong with that (heck, we even provide the --xml
> switch so you can get a parseable format), although if you do try to
> do it via the perl API I'm sure patches to improve its documentation
> would be more than welcome.

I've love to..if I knew what the API really was without guessing. :-)

- -=Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDZWWo+66dLHM50ssRAszRAJ0UNByJXFANEOnuMmxBjeCUZwiWJQCeO5Vw
9Bbih7U78j+uKoWA5A6H99E=
=6ypN
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:

> SVN::Client works fine, but it's also a little unclear on how to get
> svn:log props for each dirent returned from ->ls without making seperate
> calls to get_prop for each item when looping through them.

Well, ->ls should give you the last changed revision, so that should
be enough to use ->log to get you the log.  I suspect it might be a
bit easier to solve your problem if you explain exactly what you're
trying to do though.

> At this point, I've be a little more productive just parsing the cmd
> line client output. :-/

Well, there's nothing wrong with that (heck, we even provide the --xml
switch so you can get a parseable format), although if you do try to
do it via the perl API I'm sure patches to improve its documentation
would be more than welcome.

-garrett

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


Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Garrett Rooney wrote:
> On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> 
> 
>>Not knowing exactly where..I stumbled across this...
>>http://quicksort.net/svndocs/structsvn__ra__plugin__t.html
> 
> 
> The stuff at quicksort.net is actually very out of date (I put it up
> when I was originally converting the Subversion public headers to
> Doxygen), you're better off with the stuff at:
> 
> http://svn.collab.net/svn-doxygen/
> 
> 
>>Seeing things like get_dir/get_file... I should be able to use SVN::Ra
>>for my browseing instead of SVN::Client->cat/ls right?
> 
> 
> It's possible, although the higher level APIs in SVN::Client might be
> more convenient.  The SVN::Ra API is much more low level.

Yeah, I'll say. If you don't do C/XS, those docs aren't very helpful in
perlland.

The simplest thing

my $count = $ra->get_dir('/svn', $head);

I know there's a 3rd and 4th param, but what are they in perl-speak?
Passing \%hash or \@array get's nothing.

I get back a number. I have no idea how to actually get the contents.

SVN::Client works fine, but it's also a little unclear on how to get
svn:log props for each dirent returned from ->ls without making seperate
calls to get_prop for each item when looping through them.

At this point, I've be a little more productive just parsing the cmd
line client output. :-/


- -=Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDZV50+66dLHM50ssRAvDTAJ950C/5h0qIIyfutq8EUCKN8SWoHwCfTchK
NOzETc7TOArlCfm34uYPloU=
=+tEN
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:

> Not knowing exactly where..I stumbled across this...
> http://quicksort.net/svndocs/structsvn__ra__plugin__t.html

The stuff at quicksort.net is actually very out of date (I put it up
when I was originally converting the Subversion public headers to
Doxygen), you're better off with the stuff at:

http://svn.collab.net/svn-doxygen/

> Seeing things like get_dir/get_file... I should be able to use SVN::Ra
> for my browseing instead of SVN::Client->cat/ls right?

It's possible, although the higher level APIs in SVN::Client might be
more convenient.  The SVN::Ra API is much more low level.

-garrett

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


Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Garrett Rooney wrote:
> On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> 
> 
>>Where's a good place to find out what SVN::Ra can really do? THe pod is
>>a little slim...
> 
> 
> Looking at svn_ra.h is probably the best place to start.  Also, I

Uggh.. me no grep C/CPP :-(...

> imagine the SVK source code contains a lot of use of it, so looking
> there would be good.
> 
> -garrett
> 
> 

Not knowing exactly where..I stumbled across this...
http://quicksort.net/svndocs/structsvn__ra__plugin__t.html

Seeing things like get_dir/get_file... I should be able to use SVN::Ra
for my browseing instead of SVN::Client->cat/ls right?

- -=Chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDZRkI+66dLHM50ssRAnaPAJ41KrZNxbnoyytDSsXNv5fGVHotvQCgm5vo
v+F+HV/VGnXEEWKLYaT9Cg0=
=SOet
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/30/05, Christopher H. Laco <cl...@chrislaco.com> wrote:

> Where's a good place to find out what SVN::Ra can really do? THe pod is
> a little slim...

Looking at svn_ra.h is probably the best place to start.  Also, I
imagine the SVK source code contains a lot of use of it, so looking
there would be good.

-garrett

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


Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by "Christopher H. Laco" <cl...@chrislaco.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Garrett Rooney wrote:
> On 10/29/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> 
>>-----BEGIN PGP SIGNED MESSAGE-----
>>Hash: SHA1
>>
>>I have some code that uses SVN::Client to connect to a subversion server
>>using http. I can do all of the usual things.. list files and folders
>>with their last authoer, revisions, size, etc, and read the contents of
>>files.
>>
>>What I can't seen to figure out is how to get the current revisions of
>>that repository?
>>
>>I thought that SVN::Repos would connect to it, and then is the
>>fs->revision_root...but it appears the SVNB::Repos::open doesn't like
>>http paths at all.
> 
> 
> SVN::Repos only works on local repositories.  To get the latest
> revision number for a remote repository you need to use SVN::Ra (the
> repository access library).  This is actually the example at the top
> of SVN::Ra:
> 
>     require SVN::Core;
>     require SVN::Ra;
>     my $ra = SVN::Ra->new ('file:///tmp/svmtest');
>     print $ra->get_latest_revnum ();
> 
> Just replace the 'file:///tmp/svmtest' part with the URL of your repository.
> 
> -garrett
> 
> 

Where's a good place to find out what SVN::Ra can really do? THe pod is
a little slim...

Thanks,
- -=Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDZRW6+66dLHM50ssRAs5NAJ9mwXkHlcqTm9UtszEivNgkZF5AHQCgkkmN
1duj5XBAL4hd0j+WpurFh84=
=jO9/
-----END PGP SIGNATURE-----

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

Re: Perl equiv for 'svn info http://example.com/repos'?

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 10/29/05, Christopher H. Laco <cl...@chrislaco.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I have some code that uses SVN::Client to connect to a subversion server
> using http. I can do all of the usual things.. list files and folders
> with their last authoer, revisions, size, etc, and read the contents of
> files.
>
> What I can't seen to figure out is how to get the current revisions of
> that repository?
>
> I thought that SVN::Repos would connect to it, and then is the
> fs->revision_root...but it appears the SVNB::Repos::open doesn't like
> http paths at all.

SVN::Repos only works on local repositories.  To get the latest
revision number for a remote repository you need to use SVN::Ra (the
repository access library).  This is actually the example at the top
of SVN::Ra:

    require SVN::Core;
    require SVN::Ra;
    my $ra = SVN::Ra->new ('file:///tmp/svmtest');
    print $ra->get_latest_revnum ();

Just replace the 'file:///tmp/svmtest' part with the URL of your repository.

-garrett

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