1 | // $Id: SVNinfo.cc 978 2009-12-12 20:09:41Z 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 "SVNinfo.h" |
---|
24 | #include "SVN.h" |
---|
25 | |
---|
26 | #include <string> |
---|
27 | |
---|
28 | namespace theplu { |
---|
29 | namespace svndigest { |
---|
30 | |
---|
31 | |
---|
32 | SVNinfo::SVNinfo(const std::string& path) |
---|
33 | { |
---|
34 | SVN::instance()->client_info(path, info_receiver, |
---|
35 | static_cast<void*>(&info_receiver_baton_)); |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | svn_error_t* SVNinfo::info_receiver(void *baton, const char *, |
---|
40 | const svn_info_t *info, apr_pool_t*) |
---|
41 | { |
---|
42 | if (!info) |
---|
43 | throw SVNException(std::string("SVNinfo::info_receriver: ") + |
---|
44 | "Failed to acquire an svn info object"); |
---|
45 | |
---|
46 | info_receiver_baton* irb=static_cast<struct info_receiver_baton*>(baton); |
---|
47 | if (info->URL) |
---|
48 | irb->url_=info->URL; |
---|
49 | if (info->repos_root_URL) |
---|
50 | irb->repos_root_url_=info->repos_root_URL; |
---|
51 | if (info->last_changed_author) |
---|
52 | irb->last_changed_author_=info->last_changed_author; |
---|
53 | if (info->last_changed_rev) |
---|
54 | irb->last_changed_rev_=info->last_changed_rev; |
---|
55 | if (info->rev) |
---|
56 | irb->rev_=info->rev; |
---|
57 | |
---|
58 | return SVN_NO_ERROR; |
---|
59 | } |
---|
60 | |
---|
61 | }} // end of namespace svndigest and namespace theplu |
---|