source: trunk/lib/SVNproperty.cc @ 1152

Last change on this file since 1152 was 1152, checked in by Peter Johansson, 11 years ago

allow config file to override svn property (fixes #326). Adding two new files (split.h and split.cc) from yat.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1// $Id: SVNproperty.cc 1152 2010-08-07 14:31:18Z peter $
2
3/*
4  Copyright (C) 2006 Jari Häkkinen
5  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
6
7  This file is part of svndigest, http://dev.thep.lu.se/svndigest
8
9  svndigest is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13
14  svndigest is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "SVNproperty.h"
24
25#include "Configuration.h"
26#include "SVN.h"
27#include "utility.h"
28
29#include <string>
30
31namespace theplu {
32namespace svndigest {
33
34
35  SVNproperty::SVNproperty(const std::string& path)
36    : binary_(false), svndigest_ignore_(false)
37  {
38    SVN::instance()->client_proplist(path, property_);
39
40    const Configuration& config = Configuration::instance();
41    typedef std::map<std::string, std::string> str_map;
42    const str_map& props = config.svn_properties(file_name(path));
43    std::map<std::string, std::string>::const_iterator i = props.begin();
44    std::map<std::string, std::string>::const_iterator e = props.end();
45    // we can not use map::insert because we want config to have precedence
46    for ( ; i!=e; ++i)
47      property_[i->first] = i->second;
48   
49    i = property_.begin();
50    e = property_.end();
51    for ( ; i!=e ; ++i)
52      if (i->first == "svndigest:ignore")
53        svndigest_ignore_=true;
54      else
55        if ((i->first == "svn:mime-type") &&
56            (svn_mime_type_is_binary(i->second.c_str())))
57          binary_=true;
58  }
59
60
61  bool SVNproperty::svncopyright_ignore(void) const
62  {
63    return property_.find("svncopyright:ignore") != property_.end();
64  }
65
66}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.