[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: <kbrannen_at_gte.net>
Date: 2002-11-12 18:22:25 CET

Ben Collins-Sussman wrote:
> [Keeping this thread on the public list. There are many developers
> who can help, not just me. :-) ]
>
> kbrannen@gte.net writes:
...
>>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?

Because I was thinking that I needed to stick the file into a buffer to be
passed back to whoever called svn_client_cat and *that* function would print
to STDOUT. I was going that direction because it occurred to me that STDOUT
may be relative. For the cmdline tool, it truely is the stream STDOUT, but
for a GUI tool, it might be some browser window (or some specified filename
more likely). The part that bothers me about this is that while it works for
the vast majority of the cases, if this was done to a *big* file, the results
would not be pretty. :-) I think the solution would be to have the calling
function pass in a stream for the svn_client_cat to write to, hence removing
the "exhaust memory" problem.

>
>
>>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.

Thanks! I'll look at that. Though it now seems that Vladimir is taking care
of it, still, it gives me a chance to learn on something easy which will allow
me to consider doing other small tasks as I feel more confident. Looking at
all the apr* functions makes me feel like I'm in a maze of twisty passages all
different. :-)

Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 12 18:20:46 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.