Changeset 233 for trunk/lib/SVN.cc


Ignore:
Timestamp:
Mar 27, 2007, 12:35:38 AM (15 years ago)
Author:
Peter Johansson
Message:

Refs #117. Initial ci of SVNlog class. Class should be used and functions in SVN could be removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SVN.cc

    r228 r233  
    219219
    220220
     221  void SVN::client_log(std::string path, log_receiver_baton* lb)
     222  {
     223    // Allocate space in subpool to pool_ for apr_path (here a string).
     224    apr_pool_t *subpool = svn_pool_create(pool_);
     225    apr_array_header_t* apr_path=apr_array_make(subpool,1,4);
     226    // Copy path to apr_path.
     227    (*((const char **) apr_array_push(apr_path))) =
     228      apr_pstrdup(subpool, svn_path_internal_style(path.c_str(),subpool));
     229
     230    // Setup to retrieve all commit logs.
     231    svn_opt_revision_t peg, start, head;
     232    peg.kind=svn_opt_revision_unspecified;
     233    start.kind=svn_opt_revision_number;
     234    start.value.number=0;
     235    head.kind=svn_opt_revision_head;
     236    svn_error_t* err=NULL;
     237    // Retrieving the last revision is only needed for the reserve
     238    // call below, not needed for the functionality here.
     239    if ((err=svn_ra_get_latest_revnum(ra_session_, &(head.value.number),
     240                                      subpool)))
     241      cleanup(err, subpool, "commit_dates: svn_ra_get_latest_revnum failed");
     242    // Acctually we do not know the size of vector (and reserve most
     243    // likely over-use memory), perhaps we should use lists instead,
     244    // or do we need the random access?
     245    lb->commit_dates.reserve(head.value.number+1); // revision 0 is also stored.
     246    lb->authors.reserve(head.value.number+1); // revision 0 is also stored.
     247    lb->rev.reserve(head.value.number+1); // revision 0 is also stored.
     248    if ((err=svn_client_log3(apr_path, &peg, &start, &head, 0, false, false,
     249                             log_message_receiver, static_cast<void*>(lb),
     250                             context_, subpool)))
     251      // cleanupp will throw an exception
     252      cleanup(err, subpool, "commit_dates: svn_client_log3 failed");
     253    svn_pool_destroy(subpool);
     254  }
     255
     256
    221257  std::vector<std::string> SVN::authors(const std::string& path)
    222258  {
Note: See TracChangeset for help on using the changeset viewer.