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

Re: two questions in the SVN source code

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Sat, 6 Apr 2013 17:41:26 +0300

Ben Reser wrote on Fri, Apr 05, 2013 at 22:50:04 -0700:
> On Fri, Apr 5, 2013 at 10:02 PM, Bo Chen <bo.irvine.chen_at_gmail.com> wrote:
> > I need help for the following two questions. Any help will be appreciated.
> >
> > 1 Given a revision number, which function can (should be in libsvn_fs_fs/)
> > can read the corresponding revision from the repository (FSFS)?
> You really shouldn't be using libsvn_fs_fs directly and should use
> libsvn_repos and libsvn_fs. Beyond that I really don't know what you
> mean by "read the corresponding revision." There are all sorts of
> APIs for getting specific information about a revision. I don't think
> we have a function or a structure to represent an entire revision in
> memory. Generally you get a revision root by using
> svn_fs_revision_root() which gives you a svn_fs_root_t and then you
> use functions against it. You may find the source for svnlook

Note that that's the svn_fs.h way of doing things, i.e., the
lowest-level public API we provide. You might want to use libsvn_repos
(or even libsvn_client with file:// URLs) instead, which provide
different APIs (and hide the entire concept of "roots").

> > 2 For a variable of svn_stream_t, how can I print the information (e.g., the
> > string) stored in this variable.

The information is not stored in the variable.

svn_stream_t is an opaque struct, but if you look up its definition
you'll see it only contains an svn_read_fn_t and an svn_write_fn_t.
In other words, the "string" the variable represents is not stored in

(Oh, and there are APIs for converting streams to/from
svn_stringbuf_t's, which you might find useful.)


> If you want something quick and dirty for debugging without worrying
> about encoding you probably want to use
> svn_stream_for_stdout() or svn_stream_for_stderr() to get stdout or
> stderr as a stream and then use svn_stream_copy3().
> If you need something more permanent and care about the encoding I
> think you have to use the svn_cmdline_* functions, which don't take
> svn_stream_t's so you'll have to consume the stream with
> svn_stream_read() and then write the output with svn_cmdline_*.
Received on 2013-04-06 16:42:10 CEST

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