Changeset 233 for trunk


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.

Location:
trunk/lib
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Makefile.am

    r229 r233  
    2828noinst_HEADERS = Configuration.h Directory.h File.h Gnuplot.h GnuplotFE.h \
    2929  html_utility.h Node.h Parser.h rmdirhier.h Stats.h SVN.h SVNblame.h \
    30   SVNinfo.h SVNproperty.h utility.h
     30  SVNinfo.h SVNlog.h SVNproperty.h utility.h
    3131
    3232libsvndigest_la_SOURCES = Configuration.cc Directory.cc File.cc \
    3333  Gnuplot.cc GnuplotFE.cc \
    3434  html_utility.cc Node.cc Parser.cc rmdirhier.cc Stats.cc SVN.cc        \
    35   SVNblame.cc SVNinfo.cc SVNproperty.cc utility.cc
     35  SVNblame.cc SVNinfo.cc SVNlog.cc SVNproperty.cc utility.cc
    3636
    3737clean-local:
  • 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  {
  • trunk/lib/SVN.h

    r225 r233  
    3636namespace theplu {
    3737namespace svndigest {
     38
     39  struct log_receiver_baton;
    3840
    3941  ///
     
    109111
    110112    /**
     113       \todo doc
     114    */
     115    void client_log(std::string path, log_receiver_baton* lb);
     116
     117
     118    /**
    111119       @brief Get the properties for \a path.
    112120
     
    170178    vc_status version_controlled(const std::string& path);
    171179
    172 
    173180  private:
    174181    ///
     
    216223
    217224    // Subversion API stuff
     225
     226    static svn_error_t *
     227    log_message_receiver(void *baton, apr_hash_t *changed_paths,
     228                         svn_revnum_t rev, const char *author, const char *date,
     229                         const char *msg, apr_pool_t *pool);
     230
     231    svn_wc_adm_access_t* adm_access_;
     232    apr_allocator_t* allocator_;
     233    svn_client_ctx_t* context_;
     234    apr_pool_t* pool_;
     235    svn_ra_session_t* ra_session_;
     236  };
    218237
    219238    // Log message receiver
     
    224243      std::vector<size_t> rev;
    225244    };
    226     static svn_error_t *
    227     log_message_receiver(void *baton, apr_hash_t *changed_paths,
    228                          svn_revnum_t rev, const char *author, const char *date,
    229                          const char *msg, apr_pool_t *pool);
    230 
    231     svn_wc_adm_access_t* adm_access_;
    232     apr_allocator_t* allocator_;
    233     svn_client_ctx_t* context_;
    234     apr_pool_t* pool_;
    235     svn_ra_session_t* ra_session_;
    236   };
    237245
    238246}} // end of namespace svndigest and namespace theplu
Note: See TracChangeset for help on using the changeset viewer.