# # patch "cvs_client.cc" # from [5a061e87cd10866f2b8568abf31aa3bb500f4211] # to [c773608458a0af50889817a6789f30a8c59186a8] # # patch "cvs_client.hh" # from [5f34fca5746814524efffde190d6bcbf03e70ecc] # to [77bd606fc8a6b0a0a66d02907ab9376fc0c67299] # # patch "cvs_repository.cc" # from [d516e20f4853e9002116fd122a27e031b82e2826] # to [776fa6d23bbc956ec57501eb12e5862c84c4580f] # --- cvs_client.cc +++ cvs_client.cc @@ -682,6 +682,26 @@ return timezone2time_t(tm,dst_offs); } +time_t cvs_client::Entries2time_t(const std::string &t) +{ I(t.size()==24); + I(t[3]=' '); + I(t[7]=' '); + std::vector parts; + stringtok(parts,t); + I(parts.size()==5); + struct tm tm; + memset(&tm,0,sizeof tm); + I(parts[3][2]==':' && parts[3][5]==':'); + tm.tm_year=atoi(parts[4].c_str())-1900; + tm.tm_mon=monname2month(parts[1])-1; + tm.tm_mday=atoi(parts[2].c_str()); + tm.tm_hour=atoi(parts[3].substr(0,2).c_str()); + tm.tm_min=atoi(parts[3].substr(3,2).c_str()); + tm.tm_sec=atoi(parts[3].substr(6,2).c_str()); + tm.tm_isdst=-1; + return mktime(tm); +} + std::string cvs_client::time_t2rfc822(time_t t) { static const char * const months[12] = {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; --- cvs_client.hh +++ cvs_client.hh @@ -155,6 +155,7 @@ void drop_connection(); static std::string time_t2rfc822(time_t t); + static time_t Entries2time_t(const std::string &t); void validate_path(const std::string &local, const std::string &server); }; --- cvs_repository.cc +++ cvs_repository.cc @@ -1626,7 +1626,25 @@ } else // file { // remember permissions, store file contents - } + I(parts[0].empty()); + std::string filename=path+parts[1]; + I(!access(filename.c_str(),R_OK)); + // parts[2]=version + // parts[3]=date + // parts[4]=keyword subst + // parts[5]='T'tag + time_t modtime=cvs_client::Entries2time_t(parts[3]); + I(files.find(filename)==files.end()); + std::map::iterator f + =files.insert(std::make_pair(filename,file_history())).first; + file_state fs(modtime,parts[2]); + fs.log_msg="initial cvs content"; + fs.author="@@"; + fs.keyword_substitution=parts[4]; + // @@ import the file and check whether it is (un-)changed +// fs.sha1sum=@@ + f.known_states.insert(fs); + } } } }