Changeset 1378 for trunk


Ignore:
Timestamp:
Jun 14, 2011, 4:18:09 AM (9 years ago)
Author:
Peter Johansson
Message:

include configuration string in svncopyright cache.

Location:
trunk/lib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Configuration.cc

    r1373 r1378  
    8585  }
    8686
     87
     88  std::string Configuration::code(const std::string& path) const
     89  {
     90    std::ostringstream ss;
     91    if (const std::vector<std::pair<std::string, std::string> >*
     92        codons = codon(path)) {
     93      using std::string;
     94      typedef std::vector<std::pair<string, string> >::const_iterator citerator;
     95      for ( citerator codon=codons->begin(); codon!=codons->end(); ++codon)
     96        ss << codon->first << codon->second;
     97    }
     98    // avoid including copyright string if default is used
     99    if (copyright_string() != "Copyright (C)")
     100      ss << copyright_string();
     101    std::string result = ss.str();
     102    // we don't allow newline in codon because we parse the string
     103    // with newline and thus want the string to be a one-liner.
     104    std::replace(result.begin(), result.end(), '\n', ' ');
     105    return result;
     106  }
     107 
    87108
    88109  const std::vector<std::pair<std::string, std::string> >*
  • trunk/lib/Configuration.h

    r1155 r1378  
    6666    const std::vector<std::pair<std::string, std::string> >*
    6767    codon(std::string file_name) const;
     68
     69    /**
     70       A string describing the configuration relevant for file named
     71       \a path
     72     */
     73    std::string code(const std::string& path) const;
    6874
    6975    ///
  • trunk/lib/CopyrightStats.cc

    r1377 r1378  
    2121
    2222#include "CopyrightStats.h"
     23
     24#include "Configuration.h"
    2325#include "LineTypeParser.h"
    2426#include "SVNblame.h"
     
    4547                                                    ".svndigest"),
    4648                                   file_name(path)+".svncopyright-cache");
     49    config_ = Configuration::instance().code(path_);
    4750    init(ignore_cache, year2rev);
    4851  }
  • trunk/lib/Stats.cc

    r1348 r1378  
    5757    last_changed_rev_=svn_info.last_changed_rev();
    5858    reset();
    59 
    60     std::ostringstream ss;
    61     if (const std::vector<std::pair<std::string, std::string> >*
    62         codons = Configuration::instance().codon(path)) {
    63       using std::string;
    64       typedef std::vector<std::pair<string, string> >::const_iterator citerator;
    65       for ( citerator codon=codons->begin(); codon!=codons->end(); ++codon)
    66         ss << codon->first << codon->second;
    67     }
    68     // avoid including copyright string if default is used
    69     if (Configuration::instance().copyright_string() != "Copyright (C)")
    70       ss << Configuration::instance().copyright_string();
    71     config_code_ = ss.str();
    72     // we don't allow newline in codon because we parse the string
    73     // with newline and thus want the string to be a one-liner.
    74     std::replace(config_code_.begin(), config_code_.end(), '\n', ' ');
     59    config_code_ = Configuration::instance().code(path);
    7560  }
    7661
Note: See TracChangeset for help on using the changeset viewer.