1 | // $Id: SVNinfo.cc 142 2006-08-08 19:23:11Z jari $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2006 Jari Häkkinen |
---|
5 | |
---|
6 | This file is part of svnstat, http://lev.thep.lu.se/trac/svnstat |
---|
7 | |
---|
8 | svnstat is free software; you can redistribute it and/or modify it |
---|
9 | under the terms of the GNU General Public License as published by |
---|
10 | the Free Software Foundation; either version 2 of the License, or |
---|
11 | (at your option) any later version. |
---|
12 | |
---|
13 | svnstat is distributed in the hope that it will be useful, but |
---|
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with this program; if not, write to the Free Software |
---|
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
21 | 02111-1307, USA. |
---|
22 | */ |
---|
23 | |
---|
24 | #include "SVNinfo.h" |
---|
25 | #include "SVN.h" |
---|
26 | |
---|
27 | #include <string> |
---|
28 | |
---|
29 | namespace theplu { |
---|
30 | namespace svnstat { |
---|
31 | |
---|
32 | |
---|
33 | SVNinfo::SVNinfo(const std::string& path) |
---|
34 | : instance_(SVN::instance()) |
---|
35 | { |
---|
36 | instance_->client_info(path.c_str(), info_receiver, |
---|
37 | static_cast<void*>(&info_receiver_baton_)); |
---|
38 | } |
---|
39 | |
---|
40 | |
---|
41 | svn_error_t * |
---|
42 | SVNinfo::info_receiver(void *baton, const char *, const svn_info_t *info, |
---|
43 | apr_pool_t*) |
---|
44 | { |
---|
45 | if (!info) |
---|
46 | throw SVNException(std::string("SVNinfo::info_receriver: ") + |
---|
47 | "Failed to acquire an svn info object"); |
---|
48 | |
---|
49 | info_receiver_baton* irb=static_cast<struct info_receiver_baton*>(baton); |
---|
50 | if (info->repos_root_URL) |
---|
51 | irb->repos_root_url_=info->repos_root_URL; |
---|
52 | if (info->last_changed_author) |
---|
53 | irb->last_changed_author_=info->last_changed_author; |
---|
54 | if (info->last_changed_rev) |
---|
55 | irb->last_changed_rev_=info->last_changed_rev; |
---|
56 | if (info->rev) |
---|
57 | irb->rev_=info->rev; |
---|
58 | |
---|
59 | return SVN_NO_ERROR; |
---|
60 | } |
---|
61 | |
---|
62 | |
---|
63 | }} // end of namespace svnstat and namespace theplu |
---|