# # patch "cvs_client.hh" # from [edf1ddd8b381989b2a36b3697570c3416b66e60c] # to [5f34fca5746814524efffde190d6bcbf03e70ecc] # # patch "cvs_repository.cc" # from [6a4d304c98acc85e6deb0f855e4a8da3c3f12536] # to [d516e20f4853e9002116fd122a27e031b82e2826] # # patch "cvs_sync.hh" # from [3a937b502e1a91b6d90a6b42fadbbac6610904cc] # to [5a27c7c802164da5ffb340e112e8c0e2dc53b1dc] # --- cvs_client.hh +++ cvs_client.hh @@ -155,5 +155,7 @@ void drop_connection(); static std::string time_t2rfc822(time_t t); + + void validate_path(const std::string &local, const std::string &server); }; --- cvs_repository.cc +++ cvs_repository.cc @@ -11,6 +11,7 @@ #include "cryptopp/md5.h" #include #include +#include using namespace std; @@ -1581,7 +1582,7 @@ } } -void cvs_repository::validate_path(const std::string &local, const std::string &server) +void cvs_client::validate_path(const std::string &local, const std::string &server) { for (std::map::const_iterator i=server_dir.begin(); i!=server_dir.end();++i) { if (local.substr(0,i->first.size())==i->first @@ -1593,29 +1594,38 @@ } void cvs_repository::takeover_dir(const std::string &path) -{ fstream cvs_Entries(path+"CVS/Entries"); +{ std::ifstream cvs_Entries((path+"CVS/Entries").c_str()); N(cvs_Entries.good(), F("can't open %s\n") % (path+"CVS/Entries")); - while () + L(F("takeover_dir %s\n") % path); + while (true) { std::string line; - getline(cvs_Entries,line); - if (!cvs_Entries.good() || line.empty()) + std::getline(cvs_Entries,line); + if (!cvs_Entries.good()) break; + if (!line.empty()) { std::vector parts; stringtok(parts,line,"/"); // empty last part will not get created if (parts.size()==5) parts.push_back(std::string()); + if (parts.size()!=6) + { W(F("entry line with %d components '%s'\n") % parts.size() %line); + continue; + } if (parts[0]=="D") { std::string dirname=parts[1]; // append dirname std::string subpath=path+dirname+"/"; std::string repository; - { fstream cvs_repository(subpath+"CVS/Repository"); + { ifstream cvs_repository((subpath+"CVS/Repository").c_str()); N(cvs_repository.good(), F("can't open %sCVS/Repository\n") % subpath); std::getline(cvs_repository,repository); } validate_path(subpath,repository); takeover_dir(subpath); + } + else // file + { // remember permissions, store file contents } } } --- cvs_sync.hh +++ cvs_sync.hh @@ -158,6 +158,8 @@ static time_t posix2time_t(std::string s); + void takeover_dir(const std::string &path); + public: cvs_repository(app_state &app, const std::string &repository, const std::string &module, bool connect=true);