233 |
26 Mar 07 |
peter |
1 |
#ifndef _theplu_svndigest_svnlog_ |
233 |
26 Mar 07 |
peter |
2 |
#define _theplu_svndigest_svnlog_ |
233 |
26 Mar 07 |
peter |
3 |
|
233 |
26 Mar 07 |
peter |
// $Id$ |
233 |
26 Mar 07 |
peter |
5 |
|
233 |
26 Mar 07 |
peter |
6 |
/* |
978 |
12 Dec 09 |
peter |
Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson |
847 |
17 Nov 09 |
peter |
Copyright (C) 2009 Peter Johansson |
233 |
26 Mar 07 |
peter |
9 |
|
687 |
04 Aug 08 |
peter |
This file is part of svndigest, http://dev.thep.lu.se/svndigest |
233 |
26 Mar 07 |
peter |
11 |
|
233 |
26 Mar 07 |
peter |
svndigest is free software; you can redistribute it and/or modify it |
233 |
26 Mar 07 |
peter |
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 |
233 |
26 Mar 07 |
peter |
(at your option) any later version. |
233 |
26 Mar 07 |
peter |
16 |
|
233 |
26 Mar 07 |
peter |
svndigest is distributed in the hope that it will be useful, but |
233 |
26 Mar 07 |
peter |
WITHOUT ANY WARRANTY; without even the implied warranty of |
233 |
26 Mar 07 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
233 |
26 Mar 07 |
peter |
General Public License for more details. |
233 |
26 Mar 07 |
peter |
21 |
|
233 |
26 Mar 07 |
peter |
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/>. |
233 |
26 Mar 07 |
peter |
24 |
*/ |
233 |
26 Mar 07 |
peter |
25 |
|
233 |
26 Mar 07 |
peter |
26 |
#include "SVN.h" |
233 |
26 Mar 07 |
peter |
27 |
|
256 |
30 Apr 07 |
peter |
28 |
#include "Commitment.h" |
256 |
30 Apr 07 |
peter |
29 |
|
233 |
26 Mar 07 |
peter |
30 |
#include <string> |
759 |
29 Jan 09 |
peter |
31 |
#include <set> |
233 |
26 Mar 07 |
peter |
32 |
|
233 |
26 Mar 07 |
peter |
33 |
#include <subversion-1/svn_client.h> |
233 |
26 Mar 07 |
peter |
34 |
|
233 |
26 Mar 07 |
peter |
35 |
namespace theplu { |
233 |
26 Mar 07 |
peter |
36 |
namespace svndigest { |
233 |
26 Mar 07 |
peter |
37 |
|
233 |
26 Mar 07 |
peter |
38 |
class SVN; |
233 |
26 Mar 07 |
peter |
39 |
|
233 |
26 Mar 07 |
peter |
40 |
/** |
233 |
26 Mar 07 |
peter |
The SVNlog class is a utility class for taking care of 'svn |
233 |
26 Mar 07 |
peter |
log' information. An 'svn log' is performed on an item, the |
642 |
31 May 08 |
peter |
log information for each revision is a vector<Commitment>. |
233 |
26 Mar 07 |
peter |
44 |
*/ |
233 |
26 Mar 07 |
peter |
45 |
class SVNlog { |
233 |
26 Mar 07 |
peter |
46 |
public: |
233 |
26 Mar 07 |
peter |
47 |
/** |
759 |
29 Jan 09 |
peter |
container used to store log |
759 |
29 Jan 09 |
peter |
49 |
*/ |
759 |
29 Jan 09 |
peter |
50 |
typedef std::set<Commitment, LessRevision> container; |
759 |
29 Jan 09 |
peter |
51 |
|
759 |
29 Jan 09 |
peter |
52 |
/** |
448 |
16 Aug 07 |
peter |
Default constructor. Creates empty log. |
448 |
16 Aug 07 |
peter |
54 |
*/ |
448 |
16 Aug 07 |
peter |
55 |
SVNlog(void); |
448 |
16 Aug 07 |
peter |
56 |
|
448 |
16 Aug 07 |
peter |
57 |
/** |
233 |
26 Mar 07 |
peter |
\brief The contructor. |
1513 |
23 Sep 12 |
peter |
59 |
|
233 |
26 Mar 07 |
peter |
The constructor performs an 'svn log' on \a path and |
233 |
26 Mar 07 |
peter |
stores the information for later access. |
233 |
26 Mar 07 |
peter |
62 |
*/ |
318 |
18 May 07 |
jari |
63 |
explicit SVNlog(const std::string& path); |
233 |
26 Mar 07 |
peter |
64 |
|
233 |
26 Mar 07 |
peter |
65 |
/** |
233 |
26 Mar 07 |
peter |
\brief The destructor. |
233 |
26 Mar 07 |
peter |
67 |
*/ |
233 |
26 Mar 07 |
peter |
68 |
~SVNlog(void); |
233 |
26 Mar 07 |
peter |
69 |
|
233 |
26 Mar 07 |
peter |
70 |
/** |
642 |
31 May 08 |
peter |
\return Commitments |
233 |
26 Mar 07 |
peter |
72 |
*/ |
759 |
29 Jan 09 |
peter |
73 |
inline const container& commits(void) const |
642 |
31 May 08 |
peter |
74 |
{ return lb_.commits; } |
233 |
26 Mar 07 |
peter |
75 |
|
233 |
26 Mar 07 |
peter |
76 |
/** |
642 |
31 May 08 |
peter |
\return Commitments |
233 |
26 Mar 07 |
peter |
78 |
*/ |
759 |
29 Jan 09 |
peter |
79 |
inline container& commits(void) |
642 |
31 May 08 |
peter |
80 |
{ return lb_.commits; } |
233 |
26 Mar 07 |
peter |
81 |
|
233 |
26 Mar 07 |
peter |
82 |
/** |
282 |
06 May 07 |
peter |
\return true if \a author appears in log. |
282 |
06 May 07 |
peter |
84 |
*/ |
282 |
06 May 07 |
peter |
85 |
bool exist(std::string author) const; |
282 |
06 May 07 |
peter |
86 |
|
282 |
06 May 07 |
peter |
87 |
/** |
259 |
30 Apr 07 |
peter |
\return Latest commit |
259 |
30 Apr 07 |
peter |
89 |
*/ |
642 |
31 May 08 |
peter |
90 |
const Commitment& latest_commit(void) const; |
259 |
30 Apr 07 |
peter |
91 |
|
259 |
30 Apr 07 |
peter |
92 |
/** |
256 |
30 Apr 07 |
peter |
\return Latest commit \a author did. If no author is found an |
256 |
30 Apr 07 |
peter |
empty Commitment (default constructor) is returned. |
256 |
30 Apr 07 |
peter |
95 |
*/ |
642 |
31 May 08 |
peter |
96 |
const Commitment& latest_commit(std::string author) const; |
256 |
30 Apr 07 |
peter |
97 |
|
256 |
30 Apr 07 |
peter |
98 |
/** |
452 |
17 Aug 07 |
peter |
99 |
*/ |
452 |
17 Aug 07 |
peter |
100 |
void swap(SVNlog&); |
1513 |
23 Sep 12 |
peter |
101 |
|
233 |
26 Mar 07 |
peter |
102 |
private: |
233 |
26 Mar 07 |
peter |
103 |
|
233 |
26 Mar 07 |
peter |
104 |
/// |
233 |
26 Mar 07 |
peter |
/// @brief Copy Constructor, not implemented. |
233 |
26 Mar 07 |
peter |
106 |
/// |
447 |
16 Aug 07 |
peter |
// using compiler generated copy constructor |
447 |
16 Aug 07 |
peter |
//SVNlog(const SVNlog&); |
233 |
26 Mar 07 |
peter |
109 |
|
318 |
18 May 07 |
jari |
110 |
/** |
318 |
18 May 07 |
jari |
log information is stored in the log_receiver_baton. The |
318 |
18 May 07 |
jari |
information is retrieved with the info_* set of member |
318 |
18 May 07 |
jari |
functions. The struct is filled in the info_receiver function. |
233 |
26 Mar 07 |
peter |
114 |
|
318 |
18 May 07 |
jari |
\see info_receiver |
318 |
18 May 07 |
jari |
116 |
*/ |
318 |
18 May 07 |
jari |
117 |
struct log_receiver_baton { |
759 |
29 Jan 09 |
peter |
118 |
container commits; |
318 |
18 May 07 |
jari |
119 |
} lb_; |
318 |
18 May 07 |
jari |
120 |
|
318 |
18 May 07 |
jari |
121 |
/** |
318 |
18 May 07 |
jari |
info_receiver is the function passed to the underlying |
318 |
18 May 07 |
jari |
subversion API. This function is called by the subversion API |
318 |
18 May 07 |
jari |
for every item matched by the conditions of the API call. |
318 |
18 May 07 |
jari |
125 |
|
318 |
18 May 07 |
jari |
\see Subversion API documentation |
318 |
18 May 07 |
jari |
127 |
*/ |
318 |
18 May 07 |
jari |
128 |
static svn_error_t* |
318 |
18 May 07 |
jari |
129 |
log_message_receiver(void *baton, apr_hash_t *changed_paths, |
318 |
18 May 07 |
jari |
130 |
svn_revnum_t rev, const char *author, const char *date, |
318 |
18 May 07 |
jari |
131 |
const char *msg, apr_pool_t *pool); |
233 |
26 Mar 07 |
peter |
132 |
}; |
233 |
26 Mar 07 |
peter |
133 |
|
448 |
16 Aug 07 |
peter |
134 |
/** |
448 |
16 Aug 07 |
peter |
135 |
*/ |
452 |
17 Aug 07 |
peter |
136 |
SVNlog& operator+=(SVNlog&, const SVNlog&); |
448 |
16 Aug 07 |
peter |
137 |
|
233 |
26 Mar 07 |
peter |
138 |
}} // end of namespace svndigest and namespace theplu |
233 |
26 Mar 07 |
peter |
139 |
|
233 |
26 Mar 07 |
peter |
140 |
#endif |