source: trunk/lib/SVNproperty.cc @ 1356

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

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

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