Changeset 1218


Ignore:
Timestamp:
Oct 10, 2010, 4:27:39 AM (13 years ago)
Author:
Peter Johansson
Message:

refs #371. Remove variable binary_ in SVNblame, which was not
used. SVNblame will now fail if ued on binary file (but we don't call
blame on binary files). The SVN class now takes care of svn errors and
translate them into exceptions via the cleanup function.

Location:
trunk/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/SVN.cc

    r1217 r1218  
    181181
    182182
    183   svn_error_t* SVN::client_blame(const std::string& path,
    184                                 svn_client_blame_receiver_t receiver,
    185                                 void *baton, svn_revnum_t rev)
     183  void SVN::client_blame(const std::string& path,
     184                        svn_client_blame_receiver_t receiver,
     185                        void *baton, svn_revnum_t rev)
    186186  {
    187187    svn_opt_revision_t head;
    188188    head.kind=svn_opt_revision_number;
    189189    head.value.number=rev;
    190     return client_blame_call(path, receiver, baton, head);
    191   }
    192 
    193   svn_error_t* SVN::client_blame(const std::string& path,
    194                                 svn_client_blame_receiver_t receiver,
    195                                 void *baton)
     190    client_blame_call(path, receiver, baton, head);
     191  }
     192
     193  void SVN::client_blame(const std::string& path,
     194                        svn_client_blame_receiver_t receiver,
     195                        void *baton)
    196196  {
    197197    svn_opt_revision_t head;
    198198    head.kind = ( svn_path_is_url(path.c_str()) ?
    199199                  svn_opt_revision_head : svn_opt_revision_base );
    200     return client_blame_call(path, receiver, baton, head);
    201   }
    202 
    203 
    204   svn_error_t* SVN::client_blame_call(const std::string& path,
    205                                       svn_client_blame_receiver_t receiver,
    206                                       void *baton, svn_opt_revision_t& head)
     200    client_blame_call(path, receiver, baton, head);
     201  }
     202
     203
     204  void SVN::client_blame_call(const std::string& path,
     205                              svn_client_blame_receiver_t receiver,
     206                              void *baton, svn_opt_revision_t& head)
    207207  {
    208208    // Setup to use all revisions
     
    216216                                       false, receiver, baton, context_,
    217217                                       subpool);
    218     if (err && err->apr_err!=SVN_ERR_CLIENT_IS_BINARY_FILE)
     218    if (err)
    219219      // cleanup will throw an exception
    220220      cleanup(err, subpool, "SVN::client_blame: svn_client_blame3 failed");
    221221    svn_pool_destroy(subpool);
    222     return err;
    223222  }
    224223
     
    328327    if (info->repos_root_URL)
    329328      rurb->path=info->repos_root_URL;
    330 
    331329    return SVN_NO_ERROR;
    332330  }
  • trunk/lib/SVN.h

    r1217 r1218  
    112112
    113113       \a path can be either a URL or an WC target.
    114 
    115        \return SVN_NO_ERROR or SVN_ERR_CLIENT_IS_BINARY_FILE, the
    116        latter can be used to trigger on binary files. Note that errors
    117        return from underlying subversion API must be cleared by the
    118        receiver.
    119 
    120        \see Subversion API (svn_error_clear).
    121     */
    122     svn_error_t * client_blame(const std::string& path,
    123                                svn_client_blame_receiver_t receiver,
    124                                void *baton);
     114    */
     115    void client_blame(const std::string& path,
     116                      svn_client_blame_receiver_t receiver,
     117                      void *baton);
    125118
    126119    /**
     
    128121       \a rev can be set.
    129122     */
    130     svn_error_t * client_blame(const std::string& path,
    131                                svn_client_blame_receiver_t receiver,
    132                                void *baton, svn_revnum_t rev);
     123    void client_blame(const std::string& path,
     124                      svn_client_blame_receiver_t receiver,
     125                      void *baton, svn_revnum_t rev);
    133126
    134127    /**
     
    288281    */
    289282    static svn_error_t*
    290     root_url_receiver(void *baton, const char *path, const svn_info_t *info,
    291                       apr_pool_t *pool);
    292 
    293     svn_error_t* client_blame_call(const std::string& path,
    294                                   svn_client_blame_receiver_t receiver,
    295                                   void *baton, svn_opt_revision_t& head);
     283    root_url_receiver(void *baton, const char *path,
     284                      const svn_info_t *info, apr_pool_t *pool);
     285
     286    void client_blame_call(const std::string& path,
     287                          svn_client_blame_receiver_t receiver,
     288                          void *baton, svn_opt_revision_t& head);
    296289
    297290    svn_wc_adm_access_t* adm_access_;
  • trunk/lib/SVNblame.cc

    r978 r1218  
    3131
    3232  SVNblame::SVNblame(const std::string& path)
    33     : binary_(false), instance_(SVN::instance())
     33    : instance_(SVN::instance())
    3434  {
    35     if (svn_error_t* err=
    36         instance_->client_blame(path.c_str(), blame_receiver,
    37                                 static_cast<void*>(&blame_receiver_baton_))) {
    38       // SVN_ERR_CLIENT_IS_BINARY_FILE is the only error allowed to
    39       // escape the client_blame call
    40       svn_error_clear(err);
    41       binary_=true;
    42     }
     35    instance_->client_blame(path.c_str(), blame_receiver,
     36                            static_cast<void*>(&blame_receiver_baton_));
    4337    blame_info_iterator_ = blame_receiver_baton_.blame_info.begin();
    4438  }
     
    4640
    4741  SVNblame::SVNblame(const std::string& path, svn_revnum_t rev)
    48     : binary_(false), instance_(SVN::instance())
     42    : instance_(SVN::instance())
    4943  {
    50     if (svn_error_t* err=
    51         instance_->client_blame(path.c_str(), blame_receiver,
    52                                 static_cast<void*>(&blame_receiver_baton_),
    53                                 rev)) {
    54       // SVN_ERR_CLIENT_IS_BINARY_FILE is the only error allowed to
    55       // escape the client_blame call
    56       svn_error_clear(err);
    57       binary_=true;
    58     }
     44    instance_->client_blame(path.c_str(), blame_receiver,
     45                            static_cast<void*>(&blame_receiver_baton_),
     46                            rev);
    5947    blame_info_iterator_ = blame_receiver_baton_.blame_info.begin();
    6048  }
     
    7563  {
    7664    return (*blame_info_iterator_)->author;
    77   }
    78 
    79 
    80   bool SVNblame::binary(void)
    81   {
    82     return binary_;
    8365  }
    8466
  • trunk/lib/SVNblame.h

    r978 r1218  
    7676    */
    7777    std::string author(void);
    78 
    79     /**
    80        Returns true if item is binary false otherwise
    81 
    82        Binary files are invalid for 'svn blame'.
    83     */
    84     bool binary(void);
    8578
    8679    /**
     
    164157    };
    165158
    166     // binary_ is true if item in any revision has been binary.
    167     bool binary_;
    168159    // blame_info_iterator_ is used in statistics analysis to traverse
    169160    // blame_receiver_baton.blame_info vector through calls to next().
Note: See TracChangeset for help on using the changeset viewer.