# # patch "cvs_client.cc" # from [4e9710497c26457c88c0a7bd6f4fe922bfcf16d6] # to [bd795fdb9a8bc92714f0465f47692671a7df259c] # # patch "cvs_client.hh" # from [06a54be4dfe382bfa0b4b4121eea9e0001db3e9e] # to [8a8459a6102164c4b8b550ba5bf2951d2d41dcba] # # patch "cvs_repository.cc" # from [696c4c5c8979c7be8e057a960ea0ab4526d064b1] # to [1341166c5e6095ae5a5d2e59768390e4c407f624] # # patch "cvs_sync.hh" # from [1f26c005c18f6c6494ddd8177987196f1c836d99] # to [57791d6c63440f5b08ba5083bfd9b25203512f5e] # ======================================================================== --- cvs_client.cc 4e9710497c26457c88c0a7bd6f4fe922bfcf16d6 +++ cvs_client.cc bd795fdb9a8bc92714f0465f47692671a7df259c @@ -1160,6 +1160,15 @@ return result; } +cvs_client::update cvs_client::Update(const std::string &file, const std::string &new_revision) +{ + struct update result; + std::vector file_revision; + file_revision.push_back(update_args(file,"",new_revision,"")); + Update(file_revision,store_here(result)); + return result; +} + // we have to update, status will give us only strange strings (and uses too // much bandwidth?) [is too verbose] void cvs_client::Update(const std::vector &file_revisions, @@ -1174,15 +1183,22 @@ { olddir=dirname(i->file); Directory(olddir); } - std::string bname=basename(i->file); - writestr("Entry /"+bname+"/"+i->old_revision+"//"+i->keyword_substitution+"/\n"); - writestr("Unchanged "+bname+"\n"); + if (!i->old_revision.empty()) + { std::string bname=basename(i->file); + writestr("Entry /"+bname+"/"+i->old_revision+"//"+i->keyword_substitution+"/\n"); + writestr("Unchanged "+bname+"\n"); + } + else I(file_revisions.size()==1); // this is only designed to work this way } if (file_revisions.size()==1 && !file_revisions.begin()->new_revision.empty()) - { - SendCommand("update","-d","-C","-u", - "-r",file_revisions.begin()->new_revision.c_str(), - "--",basename(file_revisions.begin()->file).c_str(),(void*)0); + { if (file_revisions.begin()->old_revision.empty()) + SendCommand("update","-d","-C","-A", + "-r",file_revisions.begin()->new_revision.c_str(), + "--",basename(file_revisions.begin()->file).c_str(),(void*)0); + else + SendCommand("update","-d","-C","-u", + "-r",file_revisions.begin()->new_revision.c_str(), + "--",basename(file_revisions.begin()->file).c_str(),(void*)0); } else { // needed for 1.11 ======================================================================== --- cvs_client.hh 06a54be4dfe382bfa0b4b4121eea9e0001db3e9e +++ cvs_client.hh 8a8459a6102164c4b8b550ba5bf2951d2d41dcba @@ -149,6 +149,8 @@ struct update Update(const std::string &file, const std::string &old_revision, const std::string &new_revision, const std::string &keyword_substitution); + // update can also check out files + struct update Update(const std::string &file, const std::string &new_revision); void Update(const std::vector &args, const update_callbacks &cb); // returns ("" on remove)> std::map > ======================================================================== --- cvs_repository.cc 696c4c5c8979c7be8e057a960ea0ab4526d064b1 +++ cvs_repository.cc 1341166c5e6095ae5a5d2e59768390e4c407f624 @@ -640,8 +640,16 @@ cvs_revision_nr srev(s->cvs_version); I(srev.is_parent_of(s2->cvs_version)); if (s->dead) - { cvs_client::checkout c=CheckOut2(file,s2->cvs_version); + { +#if 0 + cvs_client::checkout c=CheckOut2(file,s2->cvs_version); I(!c.dead); // dead->dead is no change, so shouldn't get a number +#else + // this might fail (?) because we issued an Entry somewhere above + // but ... we can specify the correct directory! + cvs_client::update c=Update(file,s2->cvs_version); + I(!c.removed); +#endif I(!s2->dead); // I(s2->since_when==c.mod_time); if (c.mod_time!=s2->since_when && c.mod_time!=-1 && s2->since_when!=sync_since) @@ -676,6 +684,21 @@ } } +void cvs_repository::store_checkout(std::set::iterator s2, + const cvs_client::update &c, std::string &file_contents) +{ const_cast(s2->dead)=c.removed; + if (!c.removed) + { // I(c.mod_time==s2->since_when); + if (c.mod_time!=s2->since_when && c.mod_time!=-1 && s2->since_when!=sync_since) + { W(F("checkout time %ld and log time %ld disagree\n") % c.mod_time % s2->since_when); + } + store_contents(c.contents, const_cast&>(s2->sha1sum)); + const_cast(s2->size)=c.contents.size(); + file_contents=c.contents; + const_cast(s2->keyword_substitution)=c.keyword_substitution; + } +} + void cvs_repository::fill_manifests(std::set::iterator e) { cvs_manifest current_manifest; if (e!=edges.begin()) @@ -881,8 +904,13 @@ { std::string file_contents; I(!i->second.known_states.empty()); { std::set::iterator s2=i->second.known_states.begin(); +#if 0 cvs_client::checkout c=CheckOut2(i->first,s2->cvs_version); store_checkout(s2,c,file_contents); +#else + cvs_client::update c=Update(i->first,s2->cvs_version); + store_checkout(s2,c,file_contents); +#endif } for (std::set::iterator s=i->second.known_states.begin(); s!=i->second.known_states.end();++s) @@ -1457,8 +1485,13 @@ { last=f->second.known_states.begin(); I(last!=f->second.known_states.end()); std::set::iterator s2=last; +#if 0 cvs_client::checkout c=CheckOut2(i->file,s2->cvs_version); store_checkout(s2,c,file_contents); +#else + cvs_client::update c=Update(i->file,s2->cvs_version); + store_checkout(s2,c,file_contents); +#endif } else { I(!last->sha1sum().empty()); ======================================================================== --- cvs_sync.hh 1f26c005c18f6c6494ddd8177987196f1c836d99 +++ cvs_sync.hh 57791d6c63440f5b08ba5083bfd9b25203512f5e @@ -130,6 +130,8 @@ std::string &contents); void store_checkout(std::set::iterator s2, const cvs_client::checkout &file, std::string &file_contents); + void store_checkout(std::set::iterator s2, + const cvs_client::update &file, std::string &file_contents); void store_update(std::set::const_iterator s, std::set::iterator s2,const cvs_client::update &u, std::string &file_contents);