source: trunk/lib/SVNinfo.h @ 815

Last change on this file since 815 was 768, checked in by Peter Johansson, 13 years ago

Merged patch release 0.6.7 to trunk. Delta 0.6.7 - 0.6.6

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1#ifndef _theplu_svndigest_svninfo_
2#define _theplu_svndigest_svninfo_
3
4// $Id: SVNinfo.h 768 2009-01-31 21:30:37Z peter $
5
6/*
7  Copyright (C) 2006 Jari Häkkinen
8  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2008 Peter Johansson
10
11  This file is part of svndigest, http://dev.thep.lu.se/svndigest
12
13  svndigest is free software; you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation; either version 3 of the License, or
16  (at your option) any later version.
17
18  svndigest is distributed in the hope that it will be useful, but
19  WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
25*/
26
27#include <string>
28
29#include <subversion-1/svn_client.h>
30
31namespace theplu {
32namespace svndigest {
33
34  class SVN;
35
36  ///
37  /// The SVNinfo class is a utility class for taking care of 'svn
38  /// info'.
39  ///
40  class SVNinfo {
41  public:
42
43    ///
44    /// Retrieve meta information about the item with \a path.
45    ///
46    /// @note The recursivness of the underlying subversion API is not
47    /// allowed (nor supported).
48    ///
49    explicit SVNinfo(const std::string& path);
50
51    ///
52    /// @brief Get the repository root URL.
53    ///
54    inline const std::string& repos_root_url(void) const
55    { return info_receiver_baton_.repos_root_url_; }
56
57    ///
58    /// @brief Get the URL.
59    ///
60    inline std::string url(void) const
61    { return info_receiver_baton_.url_; }
62
63    ///
64    /// @brief Get the author of the latest commit.
65    ///
66    inline const std::string& last_changed_author(void) const
67    { return info_receiver_baton_.last_changed_author_; }
68
69    ///
70    /// @brief Get the revision of the latest commit.
71    ///
72    inline svn_revnum_t last_changed_rev(void) const
73    { return info_receiver_baton_.last_changed_rev_; }
74
75    ///
76    /// @brief Get the current revision of the item.
77    ///
78    inline svn_revnum_t rev(void) const { return info_receiver_baton_.rev_; }
79
80
81  private:
82
83    ///
84    /// @brief Copy Constructor, not implemented.
85    ///
86    SVNinfo(const SVNinfo&);
87
88    ///
89    /// svn info is stored in the info_receiver_baton_. The
90    /// information is retrieved with the info_* set of member
91    /// functions. The struct is filled in the info_receiver function.
92    ///
93    /// @see info_receiver
94    ///
95    struct info_receiver_baton {
96      // more info is available but we only use these
97      std::string url_;
98      std::string repos_root_url_;
99      std::string last_changed_author_;
100      svn_revnum_t last_changed_rev_;
101      svn_revnum_t rev_;
102    } info_receiver_baton_ ;
103
104    ///
105    /// info_receiver is the function passed to the underlying
106    /// subversion API. This function is called by the subversion API
107    /// for every item matched by the conditions of the API call.
108    ///
109    /// @see Subversion API documentation
110    ///
111    // The return type should be svn_log_message_receiver_t but I
112    // cannot get it to compile (see comment for log_message_receiver
113    // in SVNlog.h)
114    static svn_error_t * info_receiver(void *baton, const char *path,
115                                       const svn_info_t *info, apr_pool_t *pool);
116  };
117
118}} // end of namespace svndigest and namespace theplu
119
120#endif
Note: See TracBrowser for help on using the repository browser.