source: trunk/lib/Node.cc @ 20

Last change on this file since 20 was 20, checked in by Jari Häkkinen, 16 years ago

Fixed subversion_controlled/info mixup..

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.1 KB
Line 
1// $Id: Node.cc 20 2005-12-30 22:02:50Z jari $
2
3#include "Node.h"
4#include "utility.h"
5
6#include <fstream>
7#include <iostream>
8#include <sstream>
9
10namespace theplu{
11namespace svnstat{
12
13  void Node::info(void) 
14  {
15    std::string system_call = "svn info " + path_ + " > svnstat.tmp";
16    int system_return = system(system_call.c_str());
17    if (system_return){
18      // Jari, throw exception.
19      std::cerr << "Error: svn info " << path_ << std::endl;     
20      exit(-1);
21    }
22    std::cerr << "Ok: svn info " << path_ << std::endl;     
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
38
39  bool Node::subversion_controlled(void) const
40  {
41    std::string system_call = "svn proplist " + path_ + ">&/dev/null";
42    return !system(system_call.c_str());
43  }
44
45}} // end of namespace svnstat and namespace theplu
Note: See TracBrowser for help on using the repository browser.