1 | // $Id: SVNproperty.cc 1144 2010-07-24 22:06:27Z 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 | |
---|
31 | namespace theplu { |
---|
32 | namespace 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; |
---|
44 | std::map<std::string, std::string>::const_iterator e; |
---|
45 | if (props) { |
---|
46 | i = props->begin(); |
---|
47 | 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 | |
---|
53 | i = property_.begin(); |
---|
54 | e = property_.end(); |
---|
55 | for ( ; i!=e ; ++i) |
---|
56 | if (i->first == "svndigest:ignore") |
---|
57 | svndigest_ignore_=true; |
---|
58 | else |
---|
59 | if ((i->first == "svn:mime-type") && |
---|
60 | (svn_mime_type_is_binary(i->second.c_str()))) |
---|
61 | binary_=true; |
---|
62 | } |
---|
63 | |
---|
64 | |
---|
65 | bool SVNproperty::svncopyright_ignore(void) const |
---|
66 | { |
---|
67 | return property_.find("svncopyright:ignore") != property_.end(); |
---|
68 | } |
---|
69 | |
---|
70 | }} // end of namespace svndigest and namespace theplu |
---|