Changeset 501 for trunk


Ignore:
Timestamp:
Oct 19, 2007, 9:14:45 PM (14 years ago)
Author:
Peter Johansson
Message:

added function calling svn blame for specific revision. refs #24.

Location:
trunk/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SVN.cc

    r439 r501  
    146146  svn_error_t* SVN::client_blame(const std::string& path,
    147147                                 svn_client_blame_receiver_t receiver,
     148                                 void *baton, svn_revnum_t rev)
     149  {
     150    svn_opt_revision_t head;
     151    head.kind=svn_opt_revision_number;
     152    head.value.number=rev;
     153    return client_blame_call(path, receiver, baton, head);
     154  }
     155
     156  svn_error_t* SVN::client_blame(const std::string& path,
     157                                 svn_client_blame_receiver_t receiver,
    148158                                 void *baton)
    149159  {
     160    svn_opt_revision_t head;
     161    head.kind = ( svn_path_is_url(path.c_str()) ?
     162                  svn_opt_revision_head : svn_opt_revision_base );
     163    return client_blame_call(path, receiver, baton, head);
     164  }
     165
     166
     167  svn_error_t* SVN::client_blame_call(const std::string& path,
     168                                      svn_client_blame_receiver_t receiver,
     169                                      void *baton, svn_opt_revision_t& head)
     170  {
    150171    // Setup to use all revisions
    151     svn_opt_revision_t peg, start, head;
     172    svn_opt_revision_t peg, start;
    152173    peg.kind=svn_opt_revision_unspecified;
    153174    start.kind=svn_opt_revision_number;
    154175    start.value.number=0;
    155     head.kind = ( svn_path_is_url(path.c_str()) ?
    156                   svn_opt_revision_head : svn_opt_revision_base );
    157176    apr_pool_t *subpool = svn_pool_create(pool_);
    158177    svn_error_t* err=svn_client_blame3(path.c_str(), &peg, &start, &head,
  • trunk/lib/SVN.h

    r439 r501  
    103103
    104104    /**
     105       \brief Same as function above with the extension that revision
     106       \a rev can be set.
     107     */
     108    svn_error_t * client_blame(const std::string& path,
     109                               svn_client_blame_receiver_t receiver,
     110                               void *baton, svn_revnum_t rev);
     111
     112    /**
    105113       \brief Call the underlying svn_client_info for \a path with \a
    106114       receiver and \a baton.
     
    262270                      apr_pool_t *pool);
    263271
     272    svn_error_t* client_blame_call(const std::string& path,
     273                                   svn_client_blame_receiver_t receiver,
     274                                   void *baton, svn_opt_revision_t& head);
     275
    264276    svn_wc_adm_access_t* adm_access_;
    265277    apr_allocator_t* allocator_;
  • trunk/lib/SVNblame.cc

    r492 r501  
    3838        instance_->client_blame(path.c_str(), blame_receiver,
    3939                                static_cast<void*>(&blame_receiver_baton_))) {
     40      // SVN_ERR_CLIENT_IS_BINARY_FILE is the only error allowed to
     41      // escape the client_blame call
     42      svn_error_clear(err);
     43      binary_=true;
     44    }
     45    blame_info_iterator_ = blame_receiver_baton_.blame_info.begin();
     46  }
     47
     48
     49  SVNblame::SVNblame(const std::string& path, svn_revnum_t rev)
     50    : binary_(false), instance_(SVN::instance())
     51  {
     52    if (svn_error_t* err=
     53        instance_->client_blame(path.c_str(), blame_receiver,
     54                                static_cast<void*>(&blame_receiver_baton_),
     55                                rev)) {
    4056      // SVN_ERR_CLIENT_IS_BINARY_FILE is the only error allowed to
    4157      // escape the client_blame call
  • trunk/lib/SVNblame.h

    r439 r501  
    5454    */
    5555    explicit SVNblame(const std::string& path);
     56
     57    /**
     58       @brief The contructor.
     59
     60       The constructor performs an 'svn blame -r rev' on \a path and
     61       initializes the SVNblame object for statistics traversal using
     62       SVNblame::next_line() and SVNblame::valid().
     63    */
     64    SVNblame(const std::string& path, svn_revnum_t rev);
    5665
    5766    /**
Note: See TracChangeset for help on using the changeset viewer.