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

Re: svn cat (was: Re: svn up -p)

From: Ben Collins-Sussman <sussman_at_collab.net>
Date: 2002-11-12 14:53:46 CET

[Keeping this thread on the public list. There are many developers
who can help, not just me. :-) ]

kbrannen@gte.net writes:

> Ben Collins-Sussman wrote:
> > kbrannen@gte.net writes:
> >
> >>>On Wed, 2002-11-06 at 14:59, Branko Èibej wrote:
> >>>
> >>>
> >>>>"cat" would fetch a file and pipe it to the standard output.
> >>>
> >>I've tried to follow this thread to see where it would go, because I
> >>find the feature highly useful and very missing. I'm not sure what
> >>the final outcome was (the thread seems to have died off), but is
> >>anyone working on it? If not, I think I might like to try, with a few
> >>pointers on direction. :-)
> > Go for it. It's super easy to do. All you need to do is write a new
> > function, svn_client_cat(), which calls RA->get_file(). A perfect way
> > to get your feet wet.
> >
>
> Thanks! I think... :-) Yes, conceptually it's very easy. However,
> I'm running into the proverbial brick wall of all newbie's to a
> project. There's all these APIs and it's really tough to know what to
> call when. Is there something written that I need to be reading that
> I haven't found yet?
>
> I've started down the path of looking at the "ls" functionality, as it
> seems somewhat similiar. I've gotten:

Excellent. 'ls' is exactly what I was going to recommend you imitate.

>
> svn_ra_init_ra_libs
> svn_ra_get_ra_library
> svn_client__open_ra_session
> svn_client__get_revision_number
> ra_lib->check_path
> if file
> /* and now it gets shaky */
> ???
> ra_lib->get_file
> ???
> svn_stringbuf_from_aprfile
> ra_lib->close
>
> I think I somehow need to get to svn_stringbuf_from_aprfile() so I can
> put the file in that and pass it back to svn_client_cat for it to
> fwrite(..., STDOUT).
>
> 1. Am I heading in the right direction?

Um, generally, yeah.... but why do you want to convert an apr_file_t
into an svn_stringbuf_t?

> 2. Can you point me to a file that I can look at that implements the
> get_file (& supporting code) in a way I need it? (IOW do you know of
> something like this off the top of your head as I don't mean for you
> to spend more than a minute or so on this).

Sure, take a look at libsvn_client/switch.c:192 and below. There's a
call to RA->get_file() in there. Notice that first creates a unique
tmpfile and gets an apr_file_t back. Then it converts the apr_file_t
into an svn_stream_t. Then the stream object is given to
RA->get_file(), which pushes data into the stream.

In your case, you probably just want to get an apr_file_t that
represents stdout, and convert that into a stream.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 12 14:56:10 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.