# # # patch "mtn_cvs/mtn_automate.cc" # from [c94c4d55812761034a1606209cf1f229f866c50e] # to [a8ff64ef8dc9e80b6297077607c05ee8c348550e] # # patch "mtn_cvs/mtn_automate.hh" # from [92864feedb9d5edd08f00c92d5abdf1a46ad9106] # to [ddec07f5d36a39e7dbfa0ddf0a69322c142ef039] # ============================================================ --- mtn_cvs/mtn_automate.cc c94c4d55812761034a1606209cf1f229f866c50e +++ mtn_cvs/mtn_automate.cc a8ff64ef8dc9e80b6297077607c05ee8c348550e @@ -10,6 +10,7 @@ #include #include #include +#include using std::string; using std::make_pair; @@ -573,7 +574,7 @@ bool mtn_automate::is_synchronized(revis return !certs.empty(); } -#if 0 +#if 1 // Name: find_newest_sync // Arguments: // sync-domain @@ -596,56 +597,47 @@ revision_id mtn_automate::find_newest_sy but might not appropriate for different RCSs) */ - set heads; - app.get_project().get_branch_heads(branch, heads); + std::vector heads; + heads=mtn_automate::heads(branch); revision_t rev; revision_id rid; - std::string domain = idx(args,0)(); while (!heads.empty()) { rid = *heads.begin(); L(FL("find_newest_sync: testing node %s") % rid); - app.db.get_revision(rid, rev); + rev=get_revision(rid); heads.erase(heads.begin()); // is there a more efficient way than to create a revision_t object? - if (is_synchronized(app,rid,rev,domain)) + if (is_synchronized(rid,rev,domain)) break; for (edge_map::const_iterator e = rev.edges.begin(); e != rev.edges.end(); ++e) { - if (!null_id(edge_old_revision(e))) - heads.insert(edge_old_revision(e)); + if (!null_id(e->first)) + heads.push_back(e->first); } N(!heads.empty(), F("no synchronized revision found in branch %s for domain %s") % branch % domain); } - set children; + std::vector children; continue_outer: L(FL("find_newest_sync: testing children of %s") % rid); - app.db.get_revision_children(rid, children); - for (set::const_iterator i=children.begin(); + children=get_revision_children(rid); + for (std::vector::const_iterator i=children.begin(); i!=children.end(); ++i) { - app.db.get_revision(*i, rev); - if (is_synchronized(app,*i,rev,domain)) + rev=get_revision(*i); + if (is_synchronized(*i,rev,domain)) { rid=*i; goto continue_outer; } } - output << rid; + return rid; } -static inline void -parse_path(basic_io::parser & parser, split_path & sp) -{ - string s; - parser.str(s); - file_path_internal(s).split(sp); -} - static void parse_attributes(std::string const& in, sync_map_t& result) { basic_io::input_source source(in,"parse_attributes"); @@ -676,7 +668,7 @@ static void parse_attributes(std::string } } -static sync_map_t get_sync_info(revision_id const& rid, string const& domain, int &depth) +sync_map_t mtn_automate::get_sync_info(revision_id const& rid, string const& domain, int &depth) { /* sync information is initially coded in DOMAIN: prefixed attributes if information needs to be changed after commit then it gets @@ -688,7 +680,7 @@ static sync_map_t get_sync_info(revision L(FL("get_sync_info: checking revision certificates %s") % rid); std::vector< revision > certs; - app.db.get_revision_certs(rid,cert_name(sync_prefix+domain),certs); + certs=get_revision_certs(rid,cert_name(sync_prefix+domain)); I(certs.size()<=1); // FIXME: what to do with multiple certs ... if (certs.size()==1) { cert_value tv; ============================================================ --- mtn_cvs/mtn_automate.hh 92864feedb9d5edd08f00c92d5abdf1a46ad9106 +++ mtn_cvs/mtn_automate.hh ddec07f5d36a39e7dbfa0ddf0a69322c142ef039 @@ -73,6 +73,7 @@ private: private: bool is_synchronized(revision_id const& rid, revision_t const& rev, std::string const& domain); + sync_map_t get_sync_info(revision_id const& rid, string const& domain, int &depth); }; #endif