- Timestamp:
- Jun 19, 2006, 11:53:16 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/bin/Makefile.am
r96 r100 24 24 bin_PROGRAMS = svnstat 25 25 26 svnstat_SOURCES = Parameter.cc rmdirhier.ccsvnstat.cc26 svnstat_SOURCES = Parameter.cc svnstat.cc 27 27 28 noinst_HEADERS = Parameter.h rmdirhier.h28 noinst_HEADERS = Parameter.h 29 29 30 30 LDADD = @top_srcdir@/lib/libsvnstat.a -L$(APR_PATH)/lib -L$(SVN_PATH)/lib \ -
trunk/bin/svnstat.cc
r92 r100 29 29 #include "rmdirhier.h" 30 30 #include "SVN.h" 31 #include "utility.h" 31 32 32 33 #include <iostream> … … 37 38 38 39 using namespace std; 39 40 ///41 /// Create directory \a dir. The call can fail in many ways, cf. 'man42 /// mkdir'. If the \a dir exists, setting \a force to true will43 /// trigger a recursive removal of the target \a dir.44 ///45 int createdir(const string& dir, bool force=false);46 47 40 48 41 int main(const int argc,const char* argv[]) … … 75 68 } 76 69 77 Directory tree(option.root()," svnstat_");70 Directory tree(option.root(),""); 78 71 tree.parse(option.verbose()); 79 72 … … 86 79 std::cerr << "svnstat: " << x.what() << std::endl; 87 80 } 88 string htmltopnode=tree.output_name()+".html";89 symlink(htmltopnode.c_str(),"index.html");81 //string htmltopnode=tree.output_name()+"/index.html"; 82 //symlink(htmltopnode.c_str(),"index.html"); 90 83 91 84 exit(0); // normal exit … … 93 86 94 87 95 int createdir(const string& dir, bool force)96 {97 struct stat buf;98 if (force && !stat(dir.c_str(),&buf))99 theplu::svnstat::rmdirhier(dir);100 101 return mkdir(dir.c_str(),0777);102 } -
trunk/lib/Directory.cc
r91 r100 26 26 #include "Node.h" 27 27 #include "SVN.h" 28 #include "utility.h" 28 29 29 30 #include <algorithm> … … 68 69 lstat(fullpath.c_str(),&nodestat); // C api from sys/stat.h 69 70 if (S_ISDIR(nodestat.st_mode)) // C api from sys/stat.h 70 daughters_.push_back(new Directory(fullpath, output_name()+" _"));71 daughters_.push_back(new Directory(fullpath, output_name()+"/")); 71 72 else 72 daughters_.push_back(new File(fullpath,output_name()+" _"));73 daughters_.push_back(new File(fullpath,output_name()+"/")); 73 74 break; 74 75 case SVN::unresolved: … … 86 87 } 87 88 89 std::string Directory::html_link(void) const 90 { 91 return "<a href=\"" + name() + "/index.html\">" + name() + "</a>"; 92 } 88 93 89 94 const Stats& Directory::parse(const bool verbose) … … 100 105 void Directory::print(const bool verbose) const 101 106 { 102 std::string output(output_name() + ".html"); 107 createdir(output_name()); 108 std::string output(output_name() + "/index.html"); 103 109 if (verbose) 104 110 std::cout << "Printing output for " << path_ << std::endl; 105 111 std::ofstream os(output.c_str()); 106 112 print_header(os); 107 os << "<p align=center>\n<img src='" << stats_.plot(output_name()+".png") 113 os << "<p align=center>\n<img src='" 114 << file_name(stats_.plot(output_name()+"/index.png")) 108 115 << "' alt='[plot]' border=0><br>\n"; 109 116 os << "<table>\n"; -
trunk/lib/Directory.h
r91 r100 59 59 ~Directory(void); 60 60 61 /// 62 /// @return A properly formatted html link to this directory. 63 /// 64 std::string html_link(void) const; 65 61 66 const Stats& parse(const bool verbose=false); 62 67 -
trunk/lib/File.cc
r84 r100 36 36 namespace svnstat{ 37 37 38 std::string File::html_link(void) const 39 { 40 return "<a href=\"" + name() + ".html\">" + name() + "</a>"; 41 } 42 43 38 44 const Stats& File::parse(const bool verbose) 39 45 { … … 58 64 std::ofstream os(output.c_str()); 59 65 print_header(os); 60 os << "<p align=center>\n<img src='" << stats_.plot(output_name()+".png") 66 os << "<p align=center>\n<img src='" 67 << file_name(stats_.plot(output_name_+".png")) 61 68 << "' alt='[plot]' border=0>\n</p>"; 62 69 print_footer(os); -
trunk/lib/File.h
r84 r100 41 41 : Node(path,output), binary_(false), ignore_(false) {} 42 42 43 /// 44 /// @return A properly formatted html link to this node. 45 /// 46 std::string html_link(void) const; 47 43 48 /// 44 49 /// Parsing out information from svn repository -
trunk/lib/Makefile.am
r96 r100 26 26 27 27 noinst_HEADERS = CommitStat.h Directory.h File.h Gnuplot.h GnuplotFE.h \ 28 Node.h Stats.h SVN.h utility.h28 Node.h rmdirhier.h Stats.h SVN.h utility.h 29 29 30 30 libsvnstat_a_SOURCES = CommitStat.cc Directory.cc File.cc Gnuplot.cc \ 31 GnuplotFE.cc Node.cc Stats.cc SVN.cc utility.cc31 GnuplotFE.cc Node.cc rmdirhier.cc Stats.cc SVN.cc utility.cc 32 32 33 33 INCLUDES = -I$(SVN_PATH)/include/subversion-1 -I$(APR_PATH)/include/apr-0 -
trunk/lib/Node.cc
r91 r100 24 24 #include "Node.h" 25 25 #include "utility.h" 26 #include <config.h> // this header file is created by configure 26 27 27 28 #include <ctime> … … 33 34 namespace svnstat{ 34 35 35 36 std::string Node::name(void) const 37 { 38 std::stringstream ss(path_); 39 std::string name; 40 while (getline(ss,name,'/')) {} 41 return name; 36 Node::Node(const std::string& path, const std::string& output="") 37 : path_(path), stats_(path) 38 { 39 output_name_ = output+file_name(path_); 42 40 } 43 44 41 45 42 void Node::print_footer(std::ostream& os) const … … 51 48 os << "<p align=center><font size=-2>Generated on " 52 49 << asctime (timeinfo) 53 << "by <a href=http://lev.thep.lu.se/trac/svnstat/>svnstat</a>" 50 << "by <a href=http://lev.thep.lu.se/trac/svnstat/>" 51 << PACKAGE_STRING << "</a>" 54 52 << "</font></p></body>\n</html>\n"; 55 53 } -
trunk/lib/Node.h
r91 r100 26 26 27 27 #include "Stats.h" 28 #include "utility.h" 28 29 29 30 #include <ostream> … … 57 58 /// @brief Constructor 58 59 /// 59 Node(const std::string& path, const std::string& output="") 60 : path_(path), stats_(path) 61 { output_name_ = output + name(); } 60 Node(const std::string&, const std::string&); 62 61 63 62 /// … … 69 68 /// @return A properly formatted html link to this node. 70 69 /// 71 inline std::string html_link(void) const 72 { return "<a href=\"" + output_name() + ".html\">" + name() + "</a>"; } 70 virtual std::string html_link(void) const=0; 73 71 74 72 inline std::string html_tablerow(void) const … … 80 78 } 81 79 80 /// 81 /// @return 82 /// 82 83 inline const std::string& output_name(void) const { return output_name_; } 83 84 … … 100 101 /// @return name of node (not full path) 101 102 /// 102 std::string name(void) const;103 inline std::string name(void) const { return file_name(path_); } 103 104 104 105 /// -
trunk/lib/utility.cc
r84 r100 23 23 24 24 #include "utility.h" 25 #include "rmdirhier.h" 25 26 26 27 #include <fstream> … … 29 30 #include <sstream> 30 31 #include <string> 32 #include <sys/stat.h> 31 33 32 34 namespace theplu{ … … 40 42 std::cerr << "Error: svn blame " << path << std::endl; 41 43 return system_return; 44 } 45 46 int createdir(const std::string& dir, bool force) 47 { 48 struct stat buf; 49 if (force && !stat(dir.c_str(),&buf)) 50 rmdirhier(dir); 51 52 return mkdir(dir.c_str(),0777); 53 } 54 55 std::string file_name(const std::string& full_path) 56 { 57 std::stringstream ss(full_path); 58 std::string name; 59 while (getline(ss,name,'/')) {} 60 return name; 42 61 } 43 62 … … 61 80 } 62 81 82 83 84 63 85 }} // end of namespace svnstat and namespace theplu -
trunk/lib/utility.h
r84 r100 39 39 /// 40 40 int blame(const std::string&); 41 42 /// 43 /// Create directory \a dir. The call can fail in many ways, cf. 'man 44 /// mkdir'. If the \a dir exists, setting \a force to true will 45 /// trigger a recursive removal of the target \a dir. 46 /// 47 int createdir(const std::string& dir, bool force=false); 48 49 /// 50 /// @return everything after last '/' 51 /// 52 std::string file_name(const std::string&); 41 53 42 54 ///
Note: See TracChangeset
for help on using the changeset viewer.