165 |
24 Aug 06 |
jari |
1 |
#ifndef _theplu_svndigest_svninfo_ |
165 |
24 Aug 06 |
jari |
2 |
#define _theplu_svndigest_svninfo_ |
165 |
24 Aug 06 |
jari |
3 |
|
129 |
02 Aug 06 |
jari |
// $Id$ |
129 |
02 Aug 06 |
jari |
5 |
|
129 |
02 Aug 06 |
jari |
6 |
/* |
978 |
12 Dec 09 |
peter |
Copyright (C) 2006 Jari Häkkinen |
978 |
12 Dec 09 |
peter |
Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson |
129 |
02 Aug 06 |
jari |
9 |
|
687 |
04 Aug 08 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
129 |
02 Aug 06 |
jari |
11 |
|
149 |
12 Aug 06 |
jari |
svndigest is free software; you can redistribute it and/or modify it |
129 |
02 Aug 06 |
jari |
under the terms of the GNU General Public License as published by |
693 |
11 Sep 08 |
jari |
the Free Software Foundation; either version 3 of the License, or |
129 |
02 Aug 06 |
jari |
(at your option) any later version. |
129 |
02 Aug 06 |
jari |
16 |
|
149 |
12 Aug 06 |
jari |
svndigest is distributed in the hope that it will be useful, but |
129 |
02 Aug 06 |
jari |
WITHOUT ANY WARRANTY; without even the implied warranty of |
129 |
02 Aug 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
129 |
02 Aug 06 |
jari |
General Public License for more details. |
129 |
02 Aug 06 |
jari |
21 |
|
129 |
02 Aug 06 |
jari |
You should have received a copy of the GNU General Public License |
693 |
11 Sep 08 |
jari |
along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
129 |
02 Aug 06 |
jari |
24 |
*/ |
129 |
02 Aug 06 |
jari |
25 |
|
129 |
02 Aug 06 |
jari |
26 |
#include <string> |
129 |
02 Aug 06 |
jari |
27 |
|
164 |
23 Aug 06 |
jari |
28 |
#include <subversion-1/svn_client.h> |
129 |
02 Aug 06 |
jari |
29 |
|
129 |
02 Aug 06 |
jari |
30 |
namespace theplu { |
149 |
12 Aug 06 |
jari |
31 |
namespace svndigest { |
129 |
02 Aug 06 |
jari |
32 |
|
129 |
02 Aug 06 |
jari |
33 |
class SVN; |
129 |
02 Aug 06 |
jari |
34 |
|
129 |
02 Aug 06 |
jari |
35 |
/// |
129 |
02 Aug 06 |
jari |
/// The SVNinfo class is a utility class for taking care of 'svn |
129 |
02 Aug 06 |
jari |
/// info'. |
129 |
02 Aug 06 |
jari |
38 |
/// |
129 |
02 Aug 06 |
jari |
39 |
class SVNinfo { |
129 |
02 Aug 06 |
jari |
40 |
public: |
129 |
02 Aug 06 |
jari |
41 |
|
129 |
02 Aug 06 |
jari |
42 |
/// |
129 |
02 Aug 06 |
jari |
/// Retrieve meta information about the item with \a path. |
1513 |
23 Sep 12 |
peter |
44 |
/// |
129 |
02 Aug 06 |
jari |
/// @note The recursivness of the underlying subversion API is not |
129 |
02 Aug 06 |
jari |
/// allowed (nor supported). |
129 |
02 Aug 06 |
jari |
47 |
/// |
129 |
02 Aug 06 |
jari |
48 |
explicit SVNinfo(const std::string& path); |
129 |
02 Aug 06 |
jari |
49 |
|
129 |
02 Aug 06 |
jari |
50 |
/// |
129 |
02 Aug 06 |
jari |
/// @brief Get the repository root URL. |
129 |
02 Aug 06 |
jari |
52 |
/// |
142 |
08 Aug 06 |
jari |
53 |
inline const std::string& repos_root_url(void) const |
142 |
08 Aug 06 |
jari |
54 |
{ return info_receiver_baton_.repos_root_url_; } |
129 |
02 Aug 06 |
jari |
55 |
|
129 |
02 Aug 06 |
jari |
56 |
/// |
312 |
17 May 07 |
peter |
/// @brief Get the URL. |
312 |
17 May 07 |
peter |
58 |
/// |
312 |
17 May 07 |
peter |
59 |
inline std::string url(void) const |
312 |
17 May 07 |
peter |
60 |
{ return info_receiver_baton_.url_; } |
312 |
17 May 07 |
peter |
61 |
|
312 |
17 May 07 |
peter |
62 |
/// |
129 |
02 Aug 06 |
jari |
/// @brief Get the author of the latest commit. |
129 |
02 Aug 06 |
jari |
64 |
/// |
142 |
08 Aug 06 |
jari |
65 |
inline const std::string& last_changed_author(void) const |
142 |
08 Aug 06 |
jari |
66 |
{ return info_receiver_baton_.last_changed_author_; } |
129 |
02 Aug 06 |
jari |
67 |
|
129 |
02 Aug 06 |
jari |
68 |
/// |
129 |
02 Aug 06 |
jari |
/// @brief Get the revision of the latest commit. |
129 |
02 Aug 06 |
jari |
70 |
/// |
142 |
08 Aug 06 |
jari |
71 |
inline svn_revnum_t last_changed_rev(void) const |
142 |
08 Aug 06 |
jari |
72 |
{ return info_receiver_baton_.last_changed_rev_; } |
129 |
02 Aug 06 |
jari |
73 |
|
129 |
02 Aug 06 |
jari |
74 |
/// |
129 |
02 Aug 06 |
jari |
/// @brief Get the current revision of the item. |
129 |
02 Aug 06 |
jari |
76 |
/// |
142 |
08 Aug 06 |
jari |
77 |
inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; } |
129 |
02 Aug 06 |
jari |
78 |
|
129 |
02 Aug 06 |
jari |
79 |
|
129 |
02 Aug 06 |
jari |
80 |
private: |
129 |
02 Aug 06 |
jari |
81 |
|
129 |
02 Aug 06 |
jari |
82 |
/// |
129 |
02 Aug 06 |
jari |
/// @brief Copy Constructor, not implemented. |
129 |
02 Aug 06 |
jari |
84 |
/// |
129 |
02 Aug 06 |
jari |
85 |
SVNinfo(const SVNinfo&); |
129 |
02 Aug 06 |
jari |
86 |
|
129 |
02 Aug 06 |
jari |
87 |
/// |
129 |
02 Aug 06 |
jari |
/// svn info is stored in the info_receiver_baton_. The |
129 |
02 Aug 06 |
jari |
/// information is retrieved with the info_* set of member |
129 |
02 Aug 06 |
jari |
/// functions. The struct is filled in the info_receiver function. |
129 |
02 Aug 06 |
jari |
91 |
/// |
129 |
02 Aug 06 |
jari |
/// @see info_receiver |
129 |
02 Aug 06 |
jari |
93 |
/// |
140 |
04 Aug 06 |
jari |
94 |
struct info_receiver_baton { |
142 |
08 Aug 06 |
jari |
// more info is available but we only use these |
312 |
17 May 07 |
peter |
96 |
std::string url_; |
142 |
08 Aug 06 |
jari |
97 |
std::string repos_root_url_; |
142 |
08 Aug 06 |
jari |
98 |
std::string last_changed_author_; |
142 |
08 Aug 06 |
jari |
99 |
svn_revnum_t last_changed_rev_; |
142 |
08 Aug 06 |
jari |
100 |
svn_revnum_t rev_; |
129 |
02 Aug 06 |
jari |
101 |
} info_receiver_baton_ ; |
129 |
02 Aug 06 |
jari |
102 |
|
129 |
02 Aug 06 |
jari |
103 |
/// |
129 |
02 Aug 06 |
jari |
/// info_receiver is the function passed to the underlying |
129 |
02 Aug 06 |
jari |
/// subversion API. This function is called by the subversion API |
129 |
02 Aug 06 |
jari |
/// for every item matched by the conditions of the API call. |
129 |
02 Aug 06 |
jari |
107 |
/// |
129 |
02 Aug 06 |
jari |
/// @see Subversion API documentation |
129 |
02 Aug 06 |
jari |
109 |
/// |
129 |
02 Aug 06 |
jari |
110 |
static svn_error_t * info_receiver(void *baton, const char *path, |
129 |
02 Aug 06 |
jari |
111 |
const svn_info_t *info, apr_pool_t *pool); |
129 |
02 Aug 06 |
jari |
112 |
}; |
129 |
02 Aug 06 |
jari |
113 |
|
149 |
12 Aug 06 |
jari |
114 |
}} // end of namespace svndigest and namespace theplu |
129 |
02 Aug 06 |
jari |
115 |
|
129 |
02 Aug 06 |
jari |
116 |
#endif |