source: trunk/lib/SVNlog.cc @ 259

Last change on this file since 259 was 259, checked in by Peter Johansson, 14 years ago

fixed author table fixes #163

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1// $Id: SVNlog.cc 259 2007-04-30 13:18:51Z 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
33namespace theplu {
34namespace 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(void) const
54  {
55    return Commitment(author().back(), Date(date().back()), 
56                      message().back(), revision().back());
57                                             
58  }
59
60
61  Commitment SVNlog::latest_commit(std::string name) const
62  {
63    std::vector<std::string>::const_reverse_iterator iter = 
64      find(author().rbegin(), author().rend(), name);
65    size_t dist(std::distance(iter, author().rend()));
66    if (!dist) {
67      Commitment c;
68      assert(false);
69      return c;
70    }
71    return Commitment(author()[dist-1], Date(date()[dist-1]), 
72                      message()[dist-1], revision()[dist-1]);
73                                             
74  }
75
76}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.