1 | #ifndef _theplu_svndigest_svnlog_ |
---|
2 | #define _theplu_svndigest_svnlog_ |
---|
3 | |
---|
4 | // $Id: SVNlog.h 844 2009-11-16 17:46:35Z jari $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) 2007 Jari Häkkinen, Peter Johansson |
---|
8 | Copyright (C) 2008 Peter Johansson |
---|
9 | |
---|
10 | This file is part of svndigest, http://dev.thep.lu.se/svndigest |
---|
11 | |
---|
12 | svndigest is free software; you can redistribute it and/or modify it |
---|
13 | under the terms of the GNU General Public License as published by |
---|
14 | the Free Software Foundation; either version 3 of the License, or |
---|
15 | (at your option) any later version. |
---|
16 | |
---|
17 | svndigest is distributed in the hope that it will be useful, but |
---|
18 | WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
20 | General Public License for more details. |
---|
21 | |
---|
22 | You should have received a copy of the GNU General Public License |
---|
23 | along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
24 | */ |
---|
25 | |
---|
26 | #include "SVN.h" |
---|
27 | |
---|
28 | #include "Commitment.h" |
---|
29 | |
---|
30 | #include <string> |
---|
31 | #include <set> |
---|
32 | |
---|
33 | #include <subversion-1/svn_client.h> |
---|
34 | |
---|
35 | namespace theplu { |
---|
36 | namespace svndigest { |
---|
37 | |
---|
38 | class SVN; |
---|
39 | |
---|
40 | /** |
---|
41 | The SVNlog class is a utility class for taking care of 'svn |
---|
42 | log' information. An 'svn log' is performed on an item, the |
---|
43 | log information for each revision is a vector<Commitment>. |
---|
44 | */ |
---|
45 | class SVNlog { |
---|
46 | public: |
---|
47 | /** |
---|
48 | container used to store log |
---|
49 | */ |
---|
50 | typedef std::set<Commitment, LessRevision> container; |
---|
51 | |
---|
52 | /** |
---|
53 | Default constructor. Creates empty log. |
---|
54 | */ |
---|
55 | SVNlog(void); |
---|
56 | |
---|
57 | /** |
---|
58 | \brief The contructor. |
---|
59 | |
---|
60 | The constructor performs an 'svn log' on \a path and |
---|
61 | stores the information for later access. |
---|
62 | */ |
---|
63 | explicit SVNlog(const std::string& path); |
---|
64 | |
---|
65 | /** |
---|
66 | \brief The destructor. |
---|
67 | */ |
---|
68 | ~SVNlog(void); |
---|
69 | |
---|
70 | /** |
---|
71 | \return Commitments |
---|
72 | */ |
---|
73 | inline const container& commits(void) const |
---|
74 | { return lb_.commits; } |
---|
75 | |
---|
76 | /** |
---|
77 | \return Commitments |
---|
78 | */ |
---|
79 | inline container& commits(void) |
---|
80 | { return lb_.commits; } |
---|
81 | |
---|
82 | /** |
---|
83 | \return true if \a author appears in log. |
---|
84 | */ |
---|
85 | bool exist(std::string author) const; |
---|
86 | |
---|
87 | /** |
---|
88 | \return Latest commit |
---|
89 | */ |
---|
90 | const Commitment& latest_commit(void) const; |
---|
91 | |
---|
92 | /** |
---|
93 | \return Latest commit \a author did. If no author is found an |
---|
94 | empty Commitment (default constructor) is returned. |
---|
95 | */ |
---|
96 | const Commitment& latest_commit(std::string author) const; |
---|
97 | |
---|
98 | /** |
---|
99 | */ |
---|
100 | void swap(SVNlog&); |
---|
101 | |
---|
102 | private: |
---|
103 | |
---|
104 | /// |
---|
105 | /// @brief Copy Constructor, not implemented. |
---|
106 | /// |
---|
107 | // using compiler generated copy constructor |
---|
108 | //SVNlog(const SVNlog&); |
---|
109 | |
---|
110 | /** |
---|
111 | log information is stored in the log_receiver_baton. The |
---|
112 | information is retrieved with the info_* set of member |
---|
113 | functions. The struct is filled in the info_receiver function. |
---|
114 | |
---|
115 | \see info_receiver |
---|
116 | */ |
---|
117 | struct log_receiver_baton { |
---|
118 | container commits; |
---|
119 | } lb_; |
---|
120 | |
---|
121 | /** |
---|
122 | info_receiver is the function passed to the underlying |
---|
123 | subversion API. This function is called by the subversion API |
---|
124 | for every item matched by the conditions of the API call. |
---|
125 | |
---|
126 | \see Subversion API documentation |
---|
127 | */ |
---|
128 | static svn_error_t* |
---|
129 | log_message_receiver(void *baton, apr_hash_t *changed_paths, |
---|
130 | svn_revnum_t rev, const char *author, const char *date, |
---|
131 | const char *msg, apr_pool_t *pool); |
---|
132 | }; |
---|
133 | |
---|
134 | /** |
---|
135 | */ |
---|
136 | SVNlog& operator+=(SVNlog&, const SVNlog&); |
---|
137 | |
---|
138 | }} // end of namespace svndigest and namespace theplu |
---|
139 | |
---|
140 | #endif |
---|