source: trunk/lib/Node.cc @ 14

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

adding Stats class and removed pointer from node to its mother(dir), which enforced some changes here and there

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.2 KB
Line 
1// $Id: Node.cc 14 2005-12-30 14:57:47Z peter $
2
3#include "Node.h"
4#include "utility.h"
5
6#include <fstream>
7#include <iostream>
8#include <numeric>
9#include <sstream>
10#include <vector>
11
12namespace theplu{
13namespace svnstat{
14
15  bool Node::info()
16  {
17    std::string system_call = "svn info " + path_ + " > svnstat.tmp";
18    int system_return = system(system_call.c_str());
19    if (system_return){
20      std::cerr << "Error: svn info " << path_ << std::endl;     
21      return false;
22    }
23    std::ifstream is("svnstat.tmp");
24    std::string line;
25    while (getline(is,line)){
26      std::stringstream ss(line);
27      std::string tag;
28      getline(ss,tag,':');
29      if (tag == std::string("Repository UUID"))
30        ss >> uuid_; 
31      else if (tag == std::string("Last Changed Author"))
32        ss >> author_;
33      else if (tag == std::string("Last Changed Rev"))
34        ss >> revision_;
35    }
36   
37    return true;
38  }
39
40  bool Node::subversion_controlled(void) const {
41    std::string system_call = "svn info " + path_;
42    int system_return = system(system_call.c_str());
43    if (system_return){
44      std::cerr << "Error: svn info " << path_ << std::endl;     
45      return false;
46    }
47    std::cerr << "Alright: svn info " << path_ << std::endl;     
48
49    return true;
50  }
51
52}} // end of namespace svnstat and namespace theplu
Note: See TracBrowser for help on using the repository browser.