1 | // $Id: SVNlog.cc 256 2007-04-30 11:17:36Z peter $ |
---|
2 | |
---|
3 | /* |
---|
4 | Copyright (C) 2007 Peter Johansson |
---|
5 | |
---|
6 | This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest |
---|
7 | |
---|
8 | svndigest 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 | svndigest 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 "SVNlog.h" |
---|
25 | |
---|
26 | #include "Commitment.h" |
---|
27 | #include "SVN.h" |
---|
28 | |
---|
29 | #include <cassert> |
---|
30 | #include <string> |
---|
31 | #include <vector> |
---|
32 | |
---|
33 | namespace theplu { |
---|
34 | namespace svndigest { |
---|
35 | |
---|
36 | |
---|
37 | SVNlog::SVNlog(std::string path) |
---|
38 | { |
---|
39 | SVN* svn = SVN::instance(); |
---|
40 | svn->client_log(path, &lb_); |
---|
41 | assert(date().size()==author().size()); |
---|
42 | assert(date().size()==revision().size()); |
---|
43 | assert(date().size()==message().size()); |
---|
44 | |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | SVNlog::~SVNlog(void) |
---|
49 | { |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | Commitment SVNlog::latest_commit(std::string name) const |
---|
54 | { |
---|
55 | std::vector<std::string>::const_reverse_iterator iter = |
---|
56 | find(author().rbegin(), author().rend(), name); |
---|
57 | size_t dist(std::distance(iter, author().rend())); |
---|
58 | if (!dist) { |
---|
59 | Commitment c; |
---|
60 | return c; |
---|
61 | } |
---|
62 | return Commitment(author()[dist-1], Date(date()[dist-1]), |
---|
63 | message()[dist-1], revision()[dist-1]); |
---|
64 | |
---|
65 | } |
---|
66 | |
---|
67 | }} // end of namespace svndigest and namespace theplu |
---|