Beispiel #1
0
svn_error_t *
svn_client_revprop_list(apr_hash_t **props,
                        const char *URL,
                        const svn_opt_revision_t *revision,
                        svn_revnum_t *set_rev,
                        svn_client_ctx_t *ctx,
                        apr_pool_t *pool)
{
  svn_ra_session_t *ra_session;
  apr_hash_t *proplist;

  /* Open an RA session for the URL. Note that we don't have a local
     directory, nor a place to put temp files. */
  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, URL, NULL,
                                               NULL, FALSE, TRUE, ctx, pool));

  /* Resolve the revision into something real, and return that to the
     caller as well. */
  SVN_ERR(svn_client__get_revision_number(set_rev, NULL, ctx->wc_ctx, NULL,
                                          ra_session, revision, pool));

  /* The actual RA call. */
  SVN_ERR(svn_ra_rev_proplist(ra_session, *set_rev, &proplist, pool));

  *props = proplist;
  return SVN_NO_ERROR;
}
svn_error_t *
svn_ra_replay_range(svn_ra_session_t *session,
                    svn_revnum_t start_revision,
                    svn_revnum_t end_revision,
                    svn_revnum_t low_water_mark,
                    svn_boolean_t text_deltas,
                    svn_ra_replay_revstart_callback_t revstart_func,
                    svn_ra_replay_revfinish_callback_t revfinish_func,
                    void *replay_baton,
                    apr_pool_t *pool)
{
  svn_error_t *err =
    session->vtable->replay_range(session, start_revision, end_revision,
                                  low_water_mark, text_deltas,
                                  revstart_func, revfinish_func,
                                  replay_baton, pool);

  if (err && (err->apr_err == SVN_ERR_RA_NOT_IMPLEMENTED))
    {
      apr_pool_t *subpool = svn_pool_create(pool);
      svn_revnum_t rev;

      svn_error_clear(err);
      err = SVN_NO_ERROR;

      for (rev = start_revision ; rev <= end_revision ; rev++)
        {
          const svn_delta_editor_t *editor;
          void *edit_baton;
          apr_hash_t *rev_props;

          svn_pool_clear(subpool);

          SVN_ERR(svn_ra_rev_proplist(session, rev, &rev_props, subpool));

          SVN_ERR(revstart_func(rev, replay_baton,
                                &editor, &edit_baton,
                                rev_props,
                                subpool));
          SVN_ERR(svn_ra_replay(session, rev, low_water_mark,
                                text_deltas, editor, edit_baton,
                                subpool));
          SVN_ERR(revfinish_func(rev, replay_baton,
                                 editor, edit_baton,
                                 rev_props,
                                 subpool));
        }
      svn_pool_destroy(subpool);
    }

  return err;
}
Beispiel #3
0
/* Print a revision record header for REVISION to STDOUT_STREAM.  Use
 * SESSION to contact the repository for revision properties and
 * such.
 */
static svn_error_t *
dump_revision_header(svn_ra_session_t *session,
                     svn_stream_t *stdout_stream,
                     svn_revnum_t revision,
                     apr_pool_t *pool)
{
    apr_hash_t *prophash;
    svn_stringbuf_t *propstring;
    svn_stream_t *propstream;

    SVN_ERR(svn_stream_printf(stdout_stream, pool,
                              SVN_REPOS_DUMPFILE_REVISION_NUMBER
                              ": %ld\n", revision));

    prophash = apr_hash_make(pool);
    propstring = svn_stringbuf_create_empty(pool);
    SVN_ERR(svn_ra_rev_proplist(session, revision, &prophash, pool));

    propstream = svn_stream_from_stringbuf(propstring, pool);
    SVN_ERR(svn_hash_write2(prophash, propstream, "PROPS-END", pool));
    SVN_ERR(svn_stream_close(propstream));

    /* Property-content-length: 14; Content-length: 14 */
    SVN_ERR(svn_stream_printf(stdout_stream, pool,
                              SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH
                              ": %" APR_SIZE_T_FMT "\n",
                              propstring->len));
    SVN_ERR(svn_stream_printf(stdout_stream, pool,
                              SVN_REPOS_DUMPFILE_CONTENT_LENGTH
                              ": %" APR_SIZE_T_FMT "\n\n",
                              propstring->len));
    /* The properties */
    SVN_ERR(svn_stream_write(stdout_stream, propstring->data,
                             &(propstring->len)));
    SVN_ERR(svn_stream_printf(stdout_stream, pool, "\n"));

    return SVN_NO_ERROR;
}