On Fri, Apr 5, 2013 at 10:02 PM, Bo Chen <bo.irvine.c...@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 particularly instructive since it provides implementations of a lot of the type of queries you might want to do. Say you want to find the nodes changes in a revision, the changed command does this and it does it by retrieving the revision root, determining the base revision and then using svn_repos_replay2() to build a svn_repos_node_t tree of the changed nodes. It might be helpful for you to tell us overall what you're doing and we might be able to point you in the right direction more quickly than answering these one off questions. > 2 For a variable of svn_stream_t, how can I print the information (e.g., the > string) stored in this variable. 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_*.