Changeset 1356 for trunk


Ignore:
Timestamp:
May 18, 2011, 1:59:27 AM (10 years ago)
Author:
Peter Johansson
Message:

Let Node hold an SVNproperty rather than copy (virtually) all its members

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Node.cc

    r1354 r1356  
    5050             const std::string& local_path, const std::string& project)
    5151    : level_(level), path_(path), stats_(path), log_(NULL), 
    52       svninfo_(path)
     52      property_(path), svninfo_(path)
    5353  {
    54     SVNproperty property(path);
    55     binary_=property.binary();
    56     svndigest_ignore_=property.svndigest_ignore();
    57     svncopyright_ignore_=property.svncopyright_ignore();
    5854    if (Node::project_==std::string()) // no root directory in local path
    5955      Node::project_ = project;
     
    8278    assert(log().commits().size());
    8379    return log().latest_commit().author();
     80  }
     81
     82
     83  bool Node::binary(void) const
     84  {
     85    return property_.binary();
    8486  }
    8587
     
    178180  bool Node::svncopyright_ignore(void) const
    179181  {
    180     return svncopyright_ignore_;
     182    return property_.svncopyright_ignore();
     183  }
     184
     185
     186  bool Node::svndigest_ignore(void) const
     187  {
     188    return property_.svndigest_ignore();
    181189  }
    182190
  • trunk/lib/Node.h

    r1321 r1356  
    2929#include "SVNinfo.h"
    3030#include "SVNlog.h"
     31#include "SVNproperty.h"
    3132#include "TinyStats.h"
    3233
     
    7879       @return True if node is binary.
    7980    */
    80     inline bool binary(void) const { return binary_; }
     81    bool binary(void) const;
    8182
    8283    ///
     
    111112    */
    112113    inline bool ignore(void) const
    113     { return binary_ || svndigest_ignore_ || link_; }
     114    { return binary() || svndigest_ignore() || link_; }
    114115
    115116    /**
     
    166167       @return True if item property svndigest:ignore was set.
    167168    */
    168     inline bool svndigest_ignore(void) const { return svndigest_ignore_; }
     169    bool svndigest_ignore(void) const;
    169170
    170171    /**
     
    213214    virtual void log_core(SVNlog&) const=0;
    214215
    215     bool binary_;
    216216    bool link_;
    217217    std::string local_path_; // path from root
    218218    mutable SVNlog* log_;
    219     bool svndigest_ignore_;
    220     bool svncopyright_ignore_;
     219    SVNproperty property_;
    221220    SVNinfo svninfo_;
    222221
  • trunk/lib/SVNproperty.cc

    r1267 r1356  
    3535
    3636  SVNproperty::SVNproperty(const std::string& path)
    37     : binary_(false), svndigest_ignore_(false)
     37    : binary_(false), svncopyright_ignore_(false), svndigest_ignore_(false)
    3838  {
    39     SVN::instance()->client_proplist(path, property_);
     39    typedef std::map<std::string, std::string> str_map;
     40    str_map property;
     41    SVN::instance()->client_proplist(path, property);
    4042
    4143    const Configuration& config = Configuration::instance();
     
    4648    // we can not use map::insert because we want config to have precedence
    4749    for ( ; i!=e; ++i)
    48       property_[i->first] = i->second;
     50      property[i->first] = i->second;
    4951   
    50     i = property_.begin();
    51     e = property_.end();
     52    i = property.begin();
     53    e = property.end();
    5254    for ( ; i!=e ; ++i)
    5355      if (i->first == "svndigest:ignore")
    5456        svndigest_ignore_=true;
     57      else if (i->first == "svncopyright:ignore")
     58        svncopyright_ignore_=true;
    5559      else
    5660        if ((i->first == "svn:mime-type") &&
     
    6064
    6165
     66  bool SVNproperty::binary(void) const
     67  {
     68    return binary_;
     69  }
     70 
     71
     72  bool SVNproperty::svndigest_ignore(void) const
     73  {
     74    return svndigest_ignore_;
     75  }
     76
     77
    6278  bool SVNproperty::svncopyright_ignore(void) const
    6379  {
    64     return property_.find("svncopyright:ignore") != property_.end();
     80    return svncopyright_ignore_;
    6581  }
    6682
  • trunk/lib/SVNproperty.h

    r1267 r1356  
    5353       @return True if item is binary.
    5454    */
    55     inline bool binary(void) const { return binary_; }
     55    bool binary(void) const;
    5656
    5757    /**
     
    6565       @return True if item property svndigest:digest was set.
    6666    */
    67     inline bool svndigest_ignore(void) const { return svndigest_ignore_; }
     67    bool svndigest_ignore(void) const;
    6868
    6969    /**
     
    7878       SVNproperty object.
    7979    */
    80     inline const std::map<std::string, std::string>&
    81     properties(void) const { return property_; }
     80    //const std::map<std::string, std::string>&
     81    //properties(void) const { return property_; }
    8282
    8383  private:
    84 
    8584    ///
    8685    /// @brief Copy Constructor, not implemented.
     
    8988
    9089    bool binary_;
    91     std::map<std::string,std::string> property_;
     90    bool svncopyright_ignore_;
    9291    bool svndigest_ignore_;
    9392  };
  • trunk/test/copyright.cc

    r1321 r1356  
    106106                << " lines of Copyright (C)\n"
    107107                << "But found " << copyrights.size() << " lines.\n";
     108    for (size_t i=0; i<copyrights.size(); ++i)
     109      suite.out() << copyrights[i] << "\n";
    108110  }
    109111  else {
Note: See TracChangeset for help on using the changeset viewer.